i am using datatables.net and need to have some columns with fixed width and others to divide the remaning space in %
this is my code
{ "sName": "ragsoc_denom", "sWidth": "100%"},
{ "sName": "piva", "sWidth": "80px"},
{ "sName": "telefono", "sWidth": "100px"},
{ "sName": "indirizzo", "sWidth": "100px"},
{ "sName": "cap", "sWidth": "50px"},
{ "sName": "citta", "sWidth": "50px"},
{ "sName": "id", "sWidth": "70px"}
but it doesn't work, the percentage tables take all available space and the fixed width ones get streched to minimum
Try setting "bAutoWidth": false,
If you do not care how the remaining % is dispersed you could leave it up to datatables by setting the remaining sWidths to null.
If you do care how the remaining % are split up can you do this dynamically at runtime by taking the total static px (in this example 450px) subtract it from the current width of the table and then use that as a guide to determine the remaining percentages for the columns.
For example if i had a datatable that was 1000px
1000 - 450 = 550
I want a column which is 10% of the remaining
550px of 1000px = 55% left so 10% of 55% = 5.5%
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With