Table gets WIDTH:0px when "bVisible":false is used
Table gets WIDTH:0px when "bVisible":false is used
diondu
Posts: 24Questions: 0Answers: 0
I noticed that when I use "bVisible":false in some colunms the table auto-width does'n work.
I checked the innerHTML of the table parentNode and noticed that when I use bVisible:false in "aoColumns" definition DOM changes the style attribute of the table adding a WIDTH:0px;.
When bVisible is not used in "aoColumns" colunm definition this "WIDTH:0px;" doen't appear in the style attribute of the table and so AutoWidth works.
I checked the innerHTML of the table parentNode and noticed that when I use bVisible:false in "aoColumns" definition DOM changes the style attribute of the table adding a WIDTH:0px;.
When bVisible is not used in "aoColumns" colunm definition this "WIDTH:0px;" doen't appear in the style attribute of the table and so AutoWidth works.
This discussion has been closed.
Replies
Thanks,
Fernando
Thanks,
Allan
I can work around it for the moment by changing the class used by the datatable to be width: 100% !important; but I am curious what is making this happen.
Using v1.7.5 (and really like what it can do)
Thanks,
Mark
I am having the exact same issue.
I am using FF 3.6.15
Whenever I have a column that has its bVisible field set to true, the table is getting the following added to its HTML:
style="width: 100px;"
I have found the offending line of code, but have not had enough time to figure out why this is happening when a column has its bVisible field set to true.
The offending line of code is the second to last line of code in the function named "_fnCalculateColumnWidths"
The line reads:
[code]oSettings.nTable.style.width = _fnStringToCss( $(nCalcTmp).outerWidth() );[/code]
In the meantime, I have fixed this by commenting out this line of code, but by doing so, I do not know what side effects this might cause.
Thanks,
Mike
Allan
> Btw, how can I donate to this cause without going through paypal? Where are you located?
There is now a Google Checkout option which might suit you better: http://datatables.net/donate - and I'm UK based :-)
Regards,
Allan
I guess one workaround (very ugly!) would be to remove the CSS width attribute after each server data retrieval.
[code].css('width','');[/code]
I even have three tables in tabs, and using this technique, the problem was resolved for each of them.
So I am thinking that thecountofzero above must be on to something.
In my case i have a column that i hide conditionally, and when the bVisible was set to false, the width of all my columns was set to 0px.
I solved the problem by adding
[code]"bAutoWidth": false[/code]
I have had the same problem. I updated some data in the table and the table wasn't displayed the way I initialized it (It was too long). At first I tried 'mydoghasworms'- suggestion but It didn't have the correct result for me.
I was better off using 'Ariazlol's suggestion:
[code]"bAutoWidth": false [/code]
Thanks for that!