Sorting a Column Loses Background Color Formatting
Sorting a Column Loses Background Color Formatting
There is an current issue where you set a background color on a cell and then sorting a column, it loses the background color you've already defined it. There are another post that help me but I have to do some modification to work for my script:
Link: https://datatables.net/forums/discussion/11627/sorting-a-column-loses-background-color-formatting
Final solution:
//This is for the current css style applied for the cells:
}
table.dataTable.display td.accuracyData1 {
background-color: seagreen;
}
table.dataTable.display td.accuracyData0 {
background-color: crimson;
}
//This is what I have to add for the sorting of columns keep the cell format color I wanted to:
table.dataTable.display tbody tr.even td.accuracyData1.sorting_1 {
background-color: seagreen;
}
table.dataTable.display tbody tr.odd td.accuracyData1.sorting_1 {
background-color: seagreen;
}
table.dataTable.display tbody tr.even td.accuracyData0.sorting_1 {
background-color: crimson;
}
table.dataTable.display tbody tr.odd td.accuracyData0.sorting_1 {
background-color: crimson;
}
Hope this solution help someone.
Marco Cáceres
Replies
Thanks for sharing,
Colin