Apply function on "table header names"
Apply function on "table header names"
Dear all,
I'm currently using the createdCell function of datatables to colorize the tables depending on the value of the cell and it works perfectly well when I know in which column the data is being located by using the "targets" option.
However, I now have a new challange, where I have dynamically generated tables and where the location of the "targets" can be different. (eg. table 1 = pos 5; table 2 = pos 4 etc.)
The tables have the same Header Names eg. <th>Status</th> ...
Is there a clever way to translate the Header Names into Column Indexes ?
Best regards,
David
Answers
See the
columnDefs.targets
docs for the options you can use to select the columns. If you can apply a calssname to theth
then use that as thecolumnDefs.targets
selector.Kevin
Dear Kevin,
This works perfectly well :-)
Did I already tell you that I LOVE DataTables ?
Best regards,
David