Version 1.9.4 Pagination Displaying in Wrong Element
Version 1.9.4 Pagination Displaying in Wrong Element
I am updating datatables based on a custom global filter.
I initialize the table like this
[code]
$.extend(true, $.fn.dataTable.defaults, {
"bProcessing": true,
"bServerSide": false,
"sDom": 'Rlrtip',
"bSortCellsTop": true,
"bStateSave": true,
"bLengthChange": false,
"iDisplayLength": 20,
"bFilter": true,
"bShowGlobal": false
});
var oTable = $('#tblMainList').DataTable({
"sDom": 'lrtip',
"bStateSave": false,
"iDisplayLength": 55,
"sAjaxSource": AjaxURL,
"aoColumns": [
{
"sWidth": "100px",
"mData": "Key",
"bSortable": false,
"sDefaultContent": ' ',
"mRender": function (data, type, full) {
var action = 'myaction';
return action;
}
},
{ "mData": "Field1" },
{ "mData": "Field2" }
],
"fnDrawCallback": function () {
SomeFunction();
}
});
[/code]
Then I refresh it like this
[code]
$('.page-filter').click(function (event) {
event.preventDefault();
$.getJSON(AjaxUpdateURL, '', function (data) {
oTable.fnClearTable();
oTable.fnAddData(data.aaData);
});
});
[/code]
The problem is I have a UL on the page as well and anytime I refresh datatables, and the other UL has a LI in it, the links for pages 2-X display in my other UL.
I initialize the table like this
[code]
$.extend(true, $.fn.dataTable.defaults, {
"bProcessing": true,
"bServerSide": false,
"sDom": 'Rlrtip',
"bSortCellsTop": true,
"bStateSave": true,
"bLengthChange": false,
"iDisplayLength": 20,
"bFilter": true,
"bShowGlobal": false
});
var oTable = $('#tblMainList').DataTable({
"sDom": 'lrtip',
"bStateSave": false,
"iDisplayLength": 55,
"sAjaxSource": AjaxURL,
"aoColumns": [
{
"sWidth": "100px",
"mData": "Key",
"bSortable": false,
"sDefaultContent": ' ',
"mRender": function (data, type, full) {
var action = 'myaction';
return action;
}
},
{ "mData": "Field1" },
{ "mData": "Field2" }
],
"fnDrawCallback": function () {
SomeFunction();
}
});
[/code]
Then I refresh it like this
[code]
$('.page-filter').click(function (event) {
event.preventDefault();
$.getJSON(AjaxUpdateURL, '', function (data) {
oTable.fnClearTable();
oTable.fnAddData(data.aaData);
});
});
[/code]
The problem is I have a UL on the page as well and anytime I refresh datatables, and the other UL has a LI in it, the links for pages 2-X display in my other UL.
This discussion has been closed.
Replies
Thanks,
Allan
Thank you for getting back to me so quick. I am using the foundation plugin which apparently did some processing of the paging and that is where the issue was. Below is the for loop that hands the paging in dataTables.foundation.js. What happened is the an[i] was being lost during the $.each. To fix this, I set a variable currentan at the top of the for loop and use that instead of the an[i]. This persisted through the process and fixed the issue.
[code]
for ( i=0, ien=an.length ; i
Regards,
Allan
Allan