Problem with FixColumn / bStateSave / aoColumnDefs:sWidth
Problem with FixColumn / bStateSave / aoColumnDefs:sWidth
BigBadBurrow
Posts: 6Questions: 0Answers: 0
I have a table with two fixed columns on the left. I specify the width of those fixed columns using aoColumnDefs. I also have bStateSave set to true.
Here's my table set-up:
[code]
var oTable = $('#datatable').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "getdata.php",
"iDisplayLength": 25,
"sDom": 'Rlfrtip',
"bJQueryUI": true,
"bAutoWidth": false,
"sScrollX": "100%",
"sScrollY": "590",
"sScrollXInner": "200%",
"bScrollCollapse": true,
"bStateSave": true, // seems to have problems with fixed columns if navigate away from page then press back
"bPaginate": true,
"sPaginationType": "full_numbers",
"oColReorder": {"iFixedColumns": 2},
"aoColumnDefs": [
{ "bSearchable": true, "aTargets": [ 0,1 ] },
{ "bVisible": false, "aTargets": [ 2 ] },
{ "sWidth": "330px", "aTargets": [ 0 ] },
{ "sWidth": "50px", "aTargets": [ 1 ] }
],
"fnInitComplete": function () {
FixedColumns( this, {
"iLeftColumns": 2
});
}
} );
[/code]
I clear my cookies and access the page and everything works fine. If I navigate away from the page, and then go back to my page with table, the width of the fixed columns is not being set, i.e. when it's using the save cookie data.
Interestingly, what looks to happen is when I clear the cookie data and access the page for the first page I can see my two fixed column straight away, even before the data has loaded, but upon returning back to the page the two fixed columns aren't initially drawn and only appear once the data has loaded. If I set bStateSave : false then I don't have any problems.
I'm not sure but it looks like the sequence of drawing the fixed columns and loadstate gets a little muddled.
Any ideas?
Here's my table set-up:
[code]
var oTable = $('#datatable').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "getdata.php",
"iDisplayLength": 25,
"sDom": 'Rlfrtip',
"bJQueryUI": true,
"bAutoWidth": false,
"sScrollX": "100%",
"sScrollY": "590",
"sScrollXInner": "200%",
"bScrollCollapse": true,
"bStateSave": true, // seems to have problems with fixed columns if navigate away from page then press back
"bPaginate": true,
"sPaginationType": "full_numbers",
"oColReorder": {"iFixedColumns": 2},
"aoColumnDefs": [
{ "bSearchable": true, "aTargets": [ 0,1 ] },
{ "bVisible": false, "aTargets": [ 2 ] },
{ "sWidth": "330px", "aTargets": [ 0 ] },
{ "sWidth": "50px", "aTargets": [ 1 ] }
],
"fnInitComplete": function () {
FixedColumns( this, {
"iLeftColumns": 2
});
}
} );
[/code]
I clear my cookies and access the page and everything works fine. If I navigate away from the page, and then go back to my page with table, the width of the fixed columns is not being set, i.e. when it's using the save cookie data.
Interestingly, what looks to happen is when I clear the cookie data and access the page for the first page I can see my two fixed column straight away, even before the data has loaded, but upon returning back to the page the two fixed columns aren't initially drawn and only appear once the data has loaded. If I set bStateSave : false then I don't have any problems.
I'm not sure but it looks like the sequence of drawing the fixed columns and loadstate gets a little muddled.
Any ideas?
This discussion has been closed.