bStateSave not working corretly

bStateSave not working corretly

HorseFaceHorseFace Posts: 2Questions: 0Answers: 0
edited August 2012 in General
Hi, i have set the bStateSave parameter set to true but havnt managed to get the state saving to work. here is my code

I create the table like this:
[code]
$("#dtable").dataTable({
"bPaginate" : true,
"bRetrieve" : true,
"bJQueryUI" : true,
"bLengthChange" : false,
"iDisplayLength" : 50,
"sScrollY" : "255px",
"bStateSave": true,
"aoColumns" : [ {"sTitle" : "Value 1"},
{"sTitle" : "Value 2"},
{"sTitle" : "Value 3"},
{"sTitle" : "Value 4"} ]
[/code]

I update the table data like this:

[code]
updateData : function() {
// Reinitialize table
var table = $("#dtable").dataTable();

// Clear Table
table.fnClearTable();

// Populate Table
table.fnAddData(this.model.get("tableData"));
}
[/code]

Filtering seems to be saved between updates but not scrolling or pagination. Any tips?

Thanks in advance
/Eric

Replies

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    fnAddData and other manipulation methods like that will always 'reset' the paging since the data might be inserted anywhere in the table when it is sorted. Possibly you might be interested in this plug-in: http://datatables.net/plug-ins/api#fnAddDataAndDisplay

    Allan
This discussion has been closed.