Setting column widths in jQuery data tables.
Setting column widths in jQuery data tables.
I have just started doing front end development and need to output data in tables. I have a whole host of report classes written into java and one front end vm file to display them all. As the data varies in each, I have allowed the user to set the column widths for the report and this gets passed through to the front end and I can output it for use in the "width": attribute.
It seems data tables is the way to go, but I have what seems to be a very simple issue in that I cannot force a column width via data tables config.
Using data tables v1.10.5
Browser: Firefox v36
Please see the fiddle here: https://jsfiddle.net/neiljohnson/4q9pwcrf/
for the simplified code. I have looked through the documentation and tried several different attributes and functions during the .dataTable and after.
The sScrollX seemed to have the 'best' output, but no where near what was required.
From the js you can see I am trying to set the fifth column width to 40%. It made no difference if I specified the column widths for the preceding columns.
Also is the structure of the table closely associated with the data present in the headings and content in the cells?
Are any further options I need to set?
Regards,
Neil