Error showing page when state save is on
Error showing page when state save is on
Cesar Bravo
Posts: 5Questions: 0Answers: 0
Hello,
I think i found a bug in the datatables plugin. I activate the state save option and press the next button to go to other page. Then, when I reload the page with few data, the table goes to the remenbered page showing data that don't exist: "Showing 11 to 4 of 4 entries"
To reproduce the error save the attached html. Load in browser. Press next button. Edit the html. Remove son data. And reload the page. You'll see "Showing 11 to 4 of 4 entries".
I think the error can be resolve changing next code on line 3178
[code]
/////////////////////////////////////////////
// BUG
// oSettings._iDisplayStart = oSettings.iInitDisplayStart;
// oSettings.iInitDisplayStart = -1;
if( oSettings.iInitDisplayStart > oSettings.fnRecordsDisplay()) {
oSettings.iInitDisplayStart = 0;
oSettings._iDisplayStart = 0;
}
else {
oSettings._iDisplayStart = oSettings.iInitDisplayStart;
oSettings.iInitDisplayStart = -1;
}
/////////////////////////////////////////////
[/code]
The example is:
[code]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Prueba
$(document).ready(function() {
var oTable = $('#tableBug').dataTable(
{
"bAutoWidth": false,
"bLengthChange": true,
"bStateSave": true,
"bAutoWidth": false,
"aoColumns": [null, null, null, null],
"bLengthChange": true
}
);
} );
Column 1
Column 2
Column 3
Column 4
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
[/code]
I think i found a bug in the datatables plugin. I activate the state save option and press the next button to go to other page. Then, when I reload the page with few data, the table goes to the remenbered page showing data that don't exist: "Showing 11 to 4 of 4 entries"
To reproduce the error save the attached html. Load in browser. Press next button. Edit the html. Remove son data. And reload the page. You'll see "Showing 11 to 4 of 4 entries".
I think the error can be resolve changing next code on line 3178
[code]
/////////////////////////////////////////////
// BUG
// oSettings._iDisplayStart = oSettings.iInitDisplayStart;
// oSettings.iInitDisplayStart = -1;
if( oSettings.iInitDisplayStart > oSettings.fnRecordsDisplay()) {
oSettings.iInitDisplayStart = 0;
oSettings._iDisplayStart = 0;
}
else {
oSettings._iDisplayStart = oSettings.iInitDisplayStart;
oSettings.iInitDisplayStart = -1;
}
/////////////////////////////////////////////
[/code]
The example is:
[code]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Prueba
$(document).ready(function() {
var oTable = $('#tableBug').dataTable(
{
"bAutoWidth": false,
"bLengthChange": true,
"bStateSave": true,
"bAutoWidth": false,
"aoColumns": [null, null, null, null],
"bLengthChange": true
}
);
} );
Column 1
Column 2
Column 3
Column 4
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
[/code]
This discussion has been closed.
Replies
Thanks very much for your post. Just to confirm the problem - you are saying that if you have lots of data initially, and go to (say) the second page, but then delete data, so there is only one page, and reload, DataTables messes up? I can certainly see how that would happen... If you could confirm that this is what you are seeing, I'll put a fix in for it.
Regards,
Allan
Regards