Headers Width with Scroller on Postback
Headers Width with Scroller on Postback
jswarrick
Posts: 5Questions: 0Answers: 0
Hi guys, I've got an issue with my datatable. I was asked to use a scroll bar, so that the users can see the header at all times. Using the scroller feature I was able to do exactly what the users wanted.
Here's my problem:
On postback, any postback, from within the page, my headers get messed up. They're all squished together about as tight as can be. But, if I click anywhere on the header or search or filter, the header immediately corrects itself.
Here is my code:
[code]
var oTable = $('#tbHistory').dataTable({
"sScrollY": 400,
"bDeferRender": true,
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bStateSave": true,
"aaSorting": [[9, "asc"]],
"aoColumns": [
null,
null,
null,
null,
null,
null,
null,
null,
{ "bSortable": false },
null
],
"oLanguage": {
"sLengthMenu": 'Display ' +
'10' +
'20' +
'50' +
'100' +
' records'
},
"iDisplayLength": 20
});
[/code]
Am I doing anything blatantly wrong? I've searched quite a bit to no avail. Any help here would be greatly appreciated.
Here's my problem:
On postback, any postback, from within the page, my headers get messed up. They're all squished together about as tight as can be. But, if I click anywhere on the header or search or filter, the header immediately corrects itself.
Here is my code:
[code]
var oTable = $('#tbHistory').dataTable({
"sScrollY": 400,
"bDeferRender": true,
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bStateSave": true,
"aaSorting": [[9, "asc"]],
"aoColumns": [
null,
null,
null,
null,
null,
null,
null,
null,
{ "bSortable": false },
null
],
"oLanguage": {
"sLengthMenu": 'Display ' +
'10' +
'20' +
'50' +
'100' +
' records'
},
"iDisplayLength": 20
});
[/code]
Am I doing anything blatantly wrong? I've searched quite a bit to no avail. Any help here would be greatly appreciated.
This discussion has been closed.
Replies
Funnily enough, if I bind that feature to the windows resize (per the example), it works... when I resize the window. If I just put the code under document.ready, it doesn't work.
[code]
width: 483px;
element.style - 887px
[/code]
My question is, how can I get it to stop rendering it as 483px on postback. Again, it fixes itself as soon as I click anywhere on the header. I'm completely stumped.
Did you ever find a fix for this? I'm having exactly the same issue, but the table-layout:fixed option makes mine worse!
In my case, the #dataTables_scrollHeadInner div has a [code]style="width: 117px;"[/code] attribute immediately after PostBack. After I click on the header, it changes instantly to [code]style="width: 739px;"[/code].
I've tried adding [code]$("#dataTables_scrollHeadInner").width("739px;");[/code] after I create the datatable, but it has no impact at all.