Amazing Behavior - Column width not readjusted despite bAutoWidth because of a CSS class
Amazing Behavior - Column width not readjusted despite bAutoWidth because of a CSS class
Yann
Posts: 5Questions: 2Answers: 0
Hi.
I don't know why in my datatables the columns width are not reajusted on pagination despite sAutoWidth option is set to true.
The amazing behavior is that it works in a certain context.
The datatable is contained in a div which has a box class. If I add the collapsed-box, the behavior of the autowidth is fine. If I remove that class, the width is fixed.
Here is my jsFiddle link : https://jsfiddle.net/yglevarec/3zcu733a/3/
Thanks
This discussion has been closed.
Answers
bAutoWidth, not sAutoWidth
The example you give appears to resize dynamically successfully. Could you give an example with it fixed - I'm not clear on what the modification required to do that is.
Beyond that, I would suggest adding
style="width:100%"
to the table. Its a pain I know, but it allows DataTables to see that the width applied to it is 100% - its darn hard to get a percentage value from CSS without an inline style.Allan
Hi Allan, and thank you for your answer.
The example where it does not work is the same, you just have to delete the "collapsed-box" class to the container div, and you will see that columns width are no more adjusted.
It seems to work as expected for me. Or have I added it to the wrong element?
Allan