Pagination not sending iDisplayStart > 0
Pagination not sending iDisplayStart > 0
I had to do this in two posts because my first post was 2916 characters to long.
I am using DataTables 1.5
Jquery Latest.
Also using the Jquery.UI. Theme ie: "bJQueryUI": true,
I am using server side / php to populate the tables.
The problem is that the iDisplayStart value that is being sent is never greater than 0 when i click the next arrow(which is gray out and it shouldn't be since i am only showing/sending 10 out of a possible 110 results. So there should be more data to page through.)
On page load i send:
[code]
bEscapeRegex true
bEscapeRegex_0 true
bEscapeRegex_1 true
bEscapeRegex_2 true
bEscapeRegex_3 true
bEscapeRegex_4 true
bEscapeRegex_5 true
bEscapeRegex_6 true
bEscapeRegex_7 true
iColumns 8
iDisplayLength 10
iDisplayStart 0
iSortCol_0 0
iSortDir_0 asc
iSortingCols 1
sColumns listingID,lastUpdate,listingOutlet,outletListingID,listingType,listingStatus,timeStart,timeEnd
sEcho 1
sSearch
sSearch_0
sSearch_1
sSearch_2
sSearch_3
sSearch_4
sSearch_5
sSearch_6
sSearch_7
userID 102
[/code]
Then I receive:
[code]
{"iTotalDisplayRecords":10,"iTotalRecords":110,"sEcho":"1","aaData":[["1000000641","12\/31\/1969","Ebay","110041649442","EbayAuction","3","10\/21\/2009","10\/28\/2009"],["1000000642","12\/31\/1969","Ebay","110041722401","EbayAuctionFixedPrice","3","10\/27\/2009","11\/03\/2009"],["1000000643","12\/31\/1969","Ebay","110041722564","EbayAuctionFixedPrice","3","10\/27\/2009","11\/03\/2009"],["1000000644","12\/31\/1969","Ebay","110041663043","EbayAuction","3","10\/22\/2009","10\/29\/2009"],["1000000645","12\/31\/1969","Ebay","110041664868","EbayAuction","3","10\/23\/2009","10\/30\/2009"],["1000000646","12\/31\/1969","Ebay","110041732010","EbayAuctionFixedPrice","2","10\/27\/2009","10\/29\/2009"],["1000000647","12\/31\/1969","Ebay","110041663223","EbayAuction","3","10\/22\/2009","10\/29\/2009"],["1000000648","12\/31\/1969","Ebay","110041733044","EbayAuctionFixedPrice","3","10\/27\/2009","11\/03\/2009"],["1000000649","12\/31\/1969","Ebay","110041733286","EbayAuctionFixedPrice","3","10\/28\/2009","11\/04\/2009"],["1000000650","12\/31\/1969","Ebay","110041733951","EbayAuctionFixedPrice","3","10\/28\/2009","11\/04\/2009"]]}
[/code]
After the page loads, the paging buttons are grayed out, yet i can still click them(the next button) and it sends another paging/ajax request.
[code]
bEscapeRegex true
bEscapeRegex_0 true
bEscapeRegex_1 true
bEscapeRegex_2 true
bEscapeRegex_3 true
bEscapeRegex_4 true
bEscapeRegex_5 true
bEscapeRegex_6 true
bEscapeRegex_7 true
iColumns 8
iDisplayLength 10
iDisplayStart 0
iSortCol_0 0
iSortDir_0 asc
iSortingCols 1
sColumns listingID,lastUpdate,listingOutlet,outletListingID,listingType,listingStatus,timeStart,timeEnd
sEcho 2
sSearch
sSearch_0
sSearch_1
sSearch_2
sSearch_3
sSearch_4
sSearch_5
sSearch_6
sSearch_7
userID 102
[/code]
And it sends back
[code]
{"iTotalDisplayRecords":10,"iTotalRecords":110,"sEcho":"2","aaData":[["1000000641","12\/31\/1969","Ebay","110041649442","EbayAuction","3","10\/21\/2009","10\/28\/2009"],["1000000642","12\/31\/1969","Ebay","110041722401","EbayAuctionFixedPrice","3","10\/27\/2009","11\/03\/2009"],["1000000643","12\/31\/1969","Ebay","110041722564","EbayAuctionFixedPrice","3","10\/27\/2009","11\/03\/2009"],["1000000644","12\/31\/1969","Ebay","110041663043","EbayAuction","3","10\/22\/2009","10\/29\/2009"],["1000000645","12\/31\/1969","Ebay","110041664868","EbayAuction","3","10\/23\/2009","10\/30\/2009"],["1000000646","12\/31\/1969","Ebay","110041732010","EbayAuctionFixedPrice","2","10\/27\/2009","10\/29\/2009"],["1000000647","12\/31\/1969","Ebay","110041663223","EbayAuction","3","10\/22\/2009","10\/29\/2009"],["1000000648","12\/31\/1969","Ebay","110041733044","EbayAuctionFixedPrice","3","10\/27\/2009","11\/03\/2009"],["1000000649","12\/31\/1969","Ebay","110041733286","EbayAuctionFixedPrice","3","10\/28\/2009","11\/04\/2009"],["1000000650","12\/31\/1969","Ebay","110041733951","EbayAuctionFixedPrice","3","10\/28\/2009","11\/04\/2009"]]}
[/code]
I am using DataTables 1.5
Jquery Latest.
Also using the Jquery.UI. Theme ie: "bJQueryUI": true,
I am using server side / php to populate the tables.
The problem is that the iDisplayStart value that is being sent is never greater than 0 when i click the next arrow(which is gray out and it shouldn't be since i am only showing/sending 10 out of a possible 110 results. So there should be more data to page through.)
On page load i send:
[code]
bEscapeRegex true
bEscapeRegex_0 true
bEscapeRegex_1 true
bEscapeRegex_2 true
bEscapeRegex_3 true
bEscapeRegex_4 true
bEscapeRegex_5 true
bEscapeRegex_6 true
bEscapeRegex_7 true
iColumns 8
iDisplayLength 10
iDisplayStart 0
iSortCol_0 0
iSortDir_0 asc
iSortingCols 1
sColumns listingID,lastUpdate,listingOutlet,outletListingID,listingType,listingStatus,timeStart,timeEnd
sEcho 1
sSearch
sSearch_0
sSearch_1
sSearch_2
sSearch_3
sSearch_4
sSearch_5
sSearch_6
sSearch_7
userID 102
[/code]
Then I receive:
[code]
{"iTotalDisplayRecords":10,"iTotalRecords":110,"sEcho":"1","aaData":[["1000000641","12\/31\/1969","Ebay","110041649442","EbayAuction","3","10\/21\/2009","10\/28\/2009"],["1000000642","12\/31\/1969","Ebay","110041722401","EbayAuctionFixedPrice","3","10\/27\/2009","11\/03\/2009"],["1000000643","12\/31\/1969","Ebay","110041722564","EbayAuctionFixedPrice","3","10\/27\/2009","11\/03\/2009"],["1000000644","12\/31\/1969","Ebay","110041663043","EbayAuction","3","10\/22\/2009","10\/29\/2009"],["1000000645","12\/31\/1969","Ebay","110041664868","EbayAuction","3","10\/23\/2009","10\/30\/2009"],["1000000646","12\/31\/1969","Ebay","110041732010","EbayAuctionFixedPrice","2","10\/27\/2009","10\/29\/2009"],["1000000647","12\/31\/1969","Ebay","110041663223","EbayAuction","3","10\/22\/2009","10\/29\/2009"],["1000000648","12\/31\/1969","Ebay","110041733044","EbayAuctionFixedPrice","3","10\/27\/2009","11\/03\/2009"],["1000000649","12\/31\/1969","Ebay","110041733286","EbayAuctionFixedPrice","3","10\/28\/2009","11\/04\/2009"],["1000000650","12\/31\/1969","Ebay","110041733951","EbayAuctionFixedPrice","3","10\/28\/2009","11\/04\/2009"]]}
[/code]
After the page loads, the paging buttons are grayed out, yet i can still click them(the next button) and it sends another paging/ajax request.
[code]
bEscapeRegex true
bEscapeRegex_0 true
bEscapeRegex_1 true
bEscapeRegex_2 true
bEscapeRegex_3 true
bEscapeRegex_4 true
bEscapeRegex_5 true
bEscapeRegex_6 true
bEscapeRegex_7 true
iColumns 8
iDisplayLength 10
iDisplayStart 0
iSortCol_0 0
iSortDir_0 asc
iSortingCols 1
sColumns listingID,lastUpdate,listingOutlet,outletListingID,listingType,listingStatus,timeStart,timeEnd
sEcho 2
sSearch
sSearch_0
sSearch_1
sSearch_2
sSearch_3
sSearch_4
sSearch_5
sSearch_6
sSearch_7
userID 102
[/code]
And it sends back
[code]
{"iTotalDisplayRecords":10,"iTotalRecords":110,"sEcho":"2","aaData":[["1000000641","12\/31\/1969","Ebay","110041649442","EbayAuction","3","10\/21\/2009","10\/28\/2009"],["1000000642","12\/31\/1969","Ebay","110041722401","EbayAuctionFixedPrice","3","10\/27\/2009","11\/03\/2009"],["1000000643","12\/31\/1969","Ebay","110041722564","EbayAuctionFixedPrice","3","10\/27\/2009","11\/03\/2009"],["1000000644","12\/31\/1969","Ebay","110041663043","EbayAuction","3","10\/22\/2009","10\/29\/2009"],["1000000645","12\/31\/1969","Ebay","110041664868","EbayAuction","3","10\/23\/2009","10\/30\/2009"],["1000000646","12\/31\/1969","Ebay","110041732010","EbayAuctionFixedPrice","2","10\/27\/2009","10\/29\/2009"],["1000000647","12\/31\/1969","Ebay","110041663223","EbayAuction","3","10\/22\/2009","10\/29\/2009"],["1000000648","12\/31\/1969","Ebay","110041733044","EbayAuctionFixedPrice","3","10\/27\/2009","11\/03\/2009"],["1000000649","12\/31\/1969","Ebay","110041733286","EbayAuctionFixedPrice","3","10\/28\/2009","11\/04\/2009"],["1000000650","12\/31\/1969","Ebay","110041733951","EbayAuctionFixedPrice","3","10\/28\/2009","11\/04\/2009"]]}
[/code]
This discussion has been closed.
Replies
Below is my html
[code]
Listing ID
Last Update
Marketplace
Outlet Listing ID
Listing Type
Status
Time Start
Time End
[/code]
And here is my javascript for the table init.
[code]
var oTable =$('#admin_user_edit_listings_table').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bAutoWidth":true,
"bFilter":true,
"bProcessing": true,
"bServerSide": true,
"sPaginationType": "full_numbers",
"fnServerData": function ( sSource, aoData, fnCallback ) {
/* Add some extra data to the sender */
aoData.push( { "name": "userID", "value": User.User.zjUserID} );
$.getJSON( sSource, aoData, function (json) {
/* Do whatever additional processing you want on the callback, then tell DataTables */
fnCallback(json);
} );
},
"sAjaxSource": "/admin/users/reports/3",
"aoColumns":
[
{
"sName":"listingID",
"sWidth":"50px"
},
{
"sName":"lastUpdate",
"sWidth":"100px"
},
{
"sName":"listingOutlet",
"sWidth":"100px"
},
{
"sName":"outletListingID"
},
{
"sName":"listingType"
},
{
"sName":"listingStatus"
},
{
"sName":"timeStart"
},
{
"sName":"timeEnd"
}
]
});
var oSettings = oTable.fnSettings();
$("tfoot input").keyup( function () {
/* Filter on the column (the index) of this element */
oTable.fnFilter( this.value, $("tfoot input").index(this));
});
[/code]
Any thoughts?
Odd one. You say you are using v1.5 - is this 1.5.0 or some other release in the 1.5.x series? I would certainly suggest upgrading to 1.5.5. I vaguely remember there being something wrong with full-numbers in 1.5.0, but can't remember if it impacted on server-side processing as well or not.
I've just tried the following code:
[code]
$(document).ready(function() {
$('#example').dataTable( {
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bAutoWidth":true,
"bFilter":true,
"bProcessing": true,
"bServerSide": true,
"sPaginationType": "full_numbers",
"fnServerData": function ( sSource, aoData, fnCallback ) {
/* Add some extra data to the sender */
aoData.push( { "name": "userID", "value": 1} );
$.getJSON( sSource, aoData, function (json) {
/* Do whatever additional processing you want on the callback, then tell DataTables */
fnCallback(json);
} );
},
"sAjaxSource": "../examples_support/server_processing.php",
"aoColumns": [
{
"sName":"listingID",
"sWidth":"50px"
},
{
"sName":"lastUpdate",
"sWidth":"100px"
},
{
"sName":"listingOutlet",
"sWidth":"100px"
},
{
"sName":"outletListingID"
},
{
"sName":"listingType"
}
]
});
var oSettings = oTable.fnSettings();
} );
[/code]
which is more or less what you've got, just slightly modified for my framework, and that seems to work okay. If upgrading doesn't fix it - perhaps you could give us a link showing a page with this problem? (or send it to me direct http://datatables.net/contact if you don't want to make the link public).
Regards,
Allan
ps. Thanks for the donation :-)
-Mark
the iTotalDisplayRecords variable needed to be greater than 10, i had assumed it meant how many results where returned but it actually is the result count after filtering.