Full_numbers pagination Next Button/iDisplayStart problem
Full_numbers pagination Next Button/iDisplayStart problem
I am using 1.7.6 and have a datatable with serverside processing:
[code]
iTable = $('#search-item-tbl').dataTable({
"bJQueryUI": true,
"bAutoWidth": false,
"bLengthChange": false,
"bPaginate": true,
"sPaginationType": "full_numbers",
"sScrollY": "406px",
"bFilter": false,
"bProcessing": false,
"iDisplayLength": "20",
"bServerSide": true,
"bSort": false,
"sAjaxSource": "http://myserver.com/serve_it.php",
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
},
"oLanguage": {
"sSearch": "Filter:",
"sEmptyTable": "There are no active search results",
"sInfo": "_START_ to _END_ of _TOTAL_"
},
"aoColumns":[
{"sWidth": "50%", "bSortable": false}
]
});
[/code]
When I initially run a query which returns 35 results, the following parameters are being passed to the server:
[code]
iDisplayLength 20
iDisplayStart 0
[/code]
Everything comes up properly: info reads "1 to 20 of 35" and I get First, Previous, 1, 2, Next and Last pagination buttons.
Now for the weird part. If I click on the 2 or Last buttons, the iDisplayStart passed to the server is "20" and the info displayed, after my server returns its data, properly reads "21 to 35 of 35". BUT, if I click on the Next button, the iDisplayStart passed to the server is "020" and, following return of data from my server, the info is incorrectly displayed as "0201 to 35 of 35". (In all cases, the correct rows are displayed in the table.)
Is there a fix for this?
Thanks.
-Doug Forrest
[code]
iTable = $('#search-item-tbl').dataTable({
"bJQueryUI": true,
"bAutoWidth": false,
"bLengthChange": false,
"bPaginate": true,
"sPaginationType": "full_numbers",
"sScrollY": "406px",
"bFilter": false,
"bProcessing": false,
"iDisplayLength": "20",
"bServerSide": true,
"bSort": false,
"sAjaxSource": "http://myserver.com/serve_it.php",
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
},
"oLanguage": {
"sSearch": "Filter:",
"sEmptyTable": "There are no active search results",
"sInfo": "_START_ to _END_ of _TOTAL_"
},
"aoColumns":[
{"sWidth": "50%", "bSortable": false}
]
});
[/code]
When I initially run a query which returns 35 results, the following parameters are being passed to the server:
[code]
iDisplayLength 20
iDisplayStart 0
[/code]
Everything comes up properly: info reads "1 to 20 of 35" and I get First, Previous, 1, 2, Next and Last pagination buttons.
Now for the weird part. If I click on the 2 or Last buttons, the iDisplayStart passed to the server is "20" and the info displayed, after my server returns its data, properly reads "21 to 35 of 35". BUT, if I click on the Next button, the iDisplayStart passed to the server is "020" and, following return of data from my server, the info is incorrectly displayed as "0201 to 35 of 35". (In all cases, the correct rows are displayed in the table.)
Is there a fix for this?
Thanks.
-Doug Forrest
This discussion has been closed.
Replies
Allan
On the server, I was setting iTotalRecords and iTotalDisplayRecords directly from the numFound value returned in a json response from a solr/lucene query and didn't realize that it was being assigned as a string instead of an integer in my code.
datatables continues to be top of the class for jQuery grids!
-Doug Forrest
i'm running into the same Problem, but i can't figure out how to tell my script to return iTotalRecords and iTotalDisplayRecords as integers. My Data is returned as follows:
[code]
{
"aaData":[
[
"\u003Ctable\u003E\n\t\u003Ctr\u003E\n\t\t\u003Ctd\u003E\n\t\t\t\u003Cimg src=\u0022.\/images\/plus.jpg\u0022 class=\u0022show_konlistdet\u0022\u003E\u003Cimg src=\u0022.\/images\/minus.jpg\u0022 class=\u0022hide_konlistdet\u0022 style=\u0022display:none\u0022\u003E\u0026nbsp;\u003Ca href=\u0022.\/index.php?action=kon_details\u0026KON_ID=3\u0022\u003Ekein Name\n\t\t\u003C\/td\u003E\n\t\u003C\/tr\u003E\n\t\u003Ctr style=\u0022display:none;\u0022\u003E\n\t\t\u003Ctd\u003E\n\u003Cspan class=\u0022listdet\u0022\u003EEs wurden keine aktiven Firmenzuordnungen gefunden.\u003C\/span\u003E\n\t\t\u003C\/td\u003E\n\t\u003C\/tr\u003E\n\u003C\/table\u003E\n"
,""
,""
,""
]
]
,"iTotalRecords":12129
,"iTotalDisplayRecords":12129
,"sEcho":1
}[/code]
what would i have to change for it to work properly?
thanks in advance!
Allan