header width issue
header width issue
Hi,
i have several tables on one page. The page has tabs . In one of the tabs, it has another nested tabs which contains this table
http://farm5.static.flickr.com/4022/4710451596_0b4bdc7625.jpg
As you can see that , the table header is not the same width with the body.If I show the sort buttons and do a sort, the header get fix(after sorting).If I call a fnDraw, the header would not get aligned again until I do a sort.
Any idea?
thanks
Florante
i have several tables on one page. The page has tabs . In one of the tabs, it has another nested tabs which contains this table
http://farm5.static.flickr.com/4022/4710451596_0b4bdc7625.jpg
As you can see that , the table header is not the same width with the body.If I show the sort buttons and do a sort, the header get fix(after sorting).If I call a fnDraw, the header would not get aligned again until I do a sort.
Any idea?
thanks
Florante
This discussion has been closed.
Replies
http://farm5.static.flickr.com/4032/4710615518_360255618b_b.jpg
Sorting the table adjusts the columns properly exactly like your app. I tried to call fnDraw and fnAdjustColumnSizing after the table have been created but doesnt fix anything.
Did you find any solution?
[code]
$('#thName').click();
[/code]
and put it in onLoad
I added a button to the page that is always visible regardless of which tab that is selected, and added a fnAdjustColumnSizing call on click. If my tab with the datatable is selected and the datatable is visible, the headers and columns are adjusted properly when I click the button, and I can see in the firebug console that the fnDrawCallback was called.
If I deselect the rich:tab with the datatable and click the same button, I can still see in the firebug console that fnDrawCallback is called but when I switch back to the rich:tab with the datatable the headers and columns are still wrong with width:0px everywhere in the header and also all rows has the wrong cell sizes.
Im beginning to suspect that I just have to do it like fnAdjustColumnSizing on tab switch and do all data manipulations like moving rows up and down in the datatable by the datatable API (insert/remove) and not do anything on the table elsewhere. The the redraw event would possibly be called every time switches a tab but I hope that the data is consistent and redrawn like it was.
I faced similar issue in adjusting width and height in smaller view of datatable. By using nowrap at header level solve my problem.
below changes added in css file.
div.dataTables_sort_wrapper{white-space:nowrap !important;}
th{white-space:nowrap !important;}
then
dataTables_scrollBody{} here , height need to adjusted using firebug.
Regards,
Indu