Dynamic Column Width and fnAdjustColumnSizing
Dynamic Column Width and fnAdjustColumnSizing
SantaClaws
Posts: 1Questions: 0Answers: 0
Hello!
I am using dataTables 1.9.4
My Settings in the init:
"bAutoWidth": false
aoColumns defined column widths are: sWidth':'80px', 'sWidth':'18px', 'sWidth':'40%', 'sWidth':'80%', 'sWidth':'60px'
I use this table in a dynamically sizable wrapper and use the function fnAdjustColumnSizing to recaculate the new column widths.
It kinda has the behaviour i want, with the biggest share of the new size going to columns 3 and 4, keeping their widths ratio at 1:2.
If i make the table really broad the supposed to be fixed columns 1,2 and 5 get increased somewhat, but its acceptable.
Now after repopulating the table with new data i need to change the first columns width to 120px.
It works once using $('#examplethead th:eq(0)').width(120), but after resizing the table and calling fnAdjustColumnSizing the first column goes back to the base 80px.
Calling the datatable constructor again trying to change the sWidth in aoColumns dynamically is forbidden.
I am looking for a way to change the initialized 80px base width to 120px, so that after calling fnAdjustColumnSizing it stays at 120px.
I hope i explained myself clearly.
Thanks in advance and best regards
Santa
I am using dataTables 1.9.4
My Settings in the init:
"bAutoWidth": false
aoColumns defined column widths are: sWidth':'80px', 'sWidth':'18px', 'sWidth':'40%', 'sWidth':'80%', 'sWidth':'60px'
I use this table in a dynamically sizable wrapper and use the function fnAdjustColumnSizing to recaculate the new column widths.
It kinda has the behaviour i want, with the biggest share of the new size going to columns 3 and 4, keeping their widths ratio at 1:2.
If i make the table really broad the supposed to be fixed columns 1,2 and 5 get increased somewhat, but its acceptable.
Now after repopulating the table with new data i need to change the first columns width to 120px.
It works once using $('#examplethead th:eq(0)').width(120), but after resizing the table and calling fnAdjustColumnSizing the first column goes back to the base 80px.
Calling the datatable constructor again trying to change the sWidth in aoColumns dynamically is forbidden.
I am looking for a way to change the initialized 80px base width to 120px, so that after calling fnAdjustColumnSizing it stays at 120px.
I hope i explained myself clearly.
Thanks in advance and best regards
Santa
This discussion has been closed.