How to add and edit markup in table cells
How to add and edit markup in table cells
I'm populating the table cells with db data, and right now I'm wrapping that string with an html span string to get access to some styles inside the cells. Is there a cleaner way to do that?
I also need to modify some of those styles, but it seems like DataTable offers no way to select anything at all. I have used .rows and .columns and .data and .nodes but none of those give me any access to anything useful. Usually I just get an object indexed by numeric identity (that is, { 0: 0, 1: 1, 2: 2 ...}.
Can these tables be modified at all?
Answers
Hi wry_discontent, the way that I style cells in my tables is in the created row call back.
In the example below I turn the 11th cell in my table row green or red based on a condition found in my table data.
https://datatables.net/reference/option/createdRow
Shay
Have you looked at applying CSS class names to columns?
https://datatables.net/reference/option/columns.className