Inconcistent iDisplayStart value when bStateSave, bServerside, bPaginate

Inconcistent iDisplayStart value when bStateSave, bServerside, bPaginate

darsheetsdarsheets Posts: 4Questions: 0Answers: 0
edited July 2013 in DataTables 1.9
I am using bStateSave and bootstrap pagination with serverside data with DataTables 1.9.4. I initially load the table which has 1000 rows and I navigate to the last page which has row numbers 950 to 1000. Then on reloading the page with a different query which has only 500 rows, due to bStatesave, the iDisplayStart value remains 950 instead of beginning from 0.
So no data is displayed in the table and the info section of datatable says - "Showing 950 to 500 of 500 entries"

This is my initialization code.
var oTable = $('#sampleTable').dataTable({
"sScrollY":"500px",
"bProcessing":true,
"bServerSide":true,
"bStateSave":true,
"sDom":'Crtipl',
"sAjaxSource":"http://testing/test.htmlx",
"iDisplayLength":50,
"bPaginate":true,
"sPaginationType":"bootstrap",
"aoColumns": [
{"mDataProp": "id"},
{"mDataProp": function(source){
return ""+source.description+""
}},
{"mDataProp": createdBy"}
],
"fnRowCallback":function(nRow, aData, iDisplayIndex){
$(nRow).on('click',$(nRow),function(){
console.log(aData);
document.location.href="edit.htmlx"
});
}
});

How to navigate to the first page and show 1-50 entries in this case ? bStateSave has to be true to save the column sorting information on reload.

Thanks,
Darsheet.

Replies

  • darsheetsdarsheets Posts: 4Questions: 0Answers: 0
    I was going through the forums and documentation and found that by using fnDisplayStart() (http://datatables.net/plug-ins/api#fnDisplayStart) API function, it is possible to do this.
    After the initialization, I just have to make a call to
    oTable.fnDisplayStart(0) and the table will point to 1st page.
This discussion has been closed.