100% table width does not work
100% table width does not work
datatables7
Posts: 2Questions: 0Answers: 0
Hi,
I'm using the latest release and I cannot make the table header to be 100% and dynamically resized with the window. I found this example: http://datatables.net/release-datatables/examples/basic_init/flexible_width.html, which is quite useless because it doesn't give any indication as what was the html before the code was executed which is true for all the examples, btw. I added width attribute to the table with a value of 100%, I also added style with width set to 100%. I tried enabling/disabling bAutoWidth. I'm creating a table with the fnServerData, so the HTML is just this:
[code]
[/code]
and I add all the rows later. When I generate the columns that I pass as aoColumns to the constructor, I don't give width to any of the columns. Later, I want to specify the width of some of the columns but I would like to see a working example. I see that it is working if I don't pass sScrollY which I need so that the table is scrollable.
Example: http://fiddle.jshell.net/ZGyuA/1/
DataTables debugger: http://debug.datatables.net/ivuxix
How can I fix this issue?
Thanks.
I'm using the latest release and I cannot make the table header to be 100% and dynamically resized with the window. I found this example: http://datatables.net/release-datatables/examples/basic_init/flexible_width.html, which is quite useless because it doesn't give any indication as what was the html before the code was executed which is true for all the examples, btw. I added width attribute to the table with a value of 100%, I also added style with width set to 100%. I tried enabling/disabling bAutoWidth. I'm creating a table with the fnServerData, so the HTML is just this:
[code]
[/code]
and I add all the rows later. When I generate the columns that I pass as aoColumns to the constructor, I don't give width to any of the columns. Later, I want to specify the width of some of the columns but I would like to see a working example. I see that it is working if I don't pass sScrollY which I need so that the table is scrollable.
Example: http://fiddle.jshell.net/ZGyuA/1/
DataTables debugger: http://debug.datatables.net/ivuxix
How can I fix this issue?
Thanks.
This discussion has been closed.
Replies
Allan
EDIT:
It doesn't seem to work when I have a big table that already needs horizontal scrolling.
JSFiddle: http://jsfiddle.net/8d73V/
DataTables debugger: http://debug.datatables.net/igomiq
I also use TableTools but I removed that code from this example. The important things start from line number 67, the ones before just data generation.
EDIT 2:
My bad, I missed the sScrollX attribute.
Allan