How to sort datatable rows based on a background color?
How to sort datatable rows based on a background color?

Hello,
My datatable rows (tr) are displayed with a background color based on some criteria (red, green and white).
I want to have an organised display (all red rows together first, then green and white rows) when my page show up.
I read that Datatables proposes classes like 'sorting_1' and 'sorting_2' to sort rows but I didn't find a way to apply these classes to my code.
Is these classes are integrated to datatables.min.css or I should download other files?
Is there another way to sort my rows?
Thank you.
Answers
With Orthogonal data you can set filtering values for "Red", "Green", etc to sort in the order you like. I would use
columns.render
for thesort
type to do this. Might look something like this:You will find a similar example on the ORthogonal data ldocs.
Kevin
Thanks for your reply.
I think that 'render' and 'data' are applied to columns?
I want to manipulate the rows data..
Please describe in more detail what you are wanting to do. Can you put together a simple example so we can see exactly what you have so we can help?
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Yep, but the ordering is done on the column, so that's why you would use
columns.render
as Kevin suggested.Also, as he said, please give more details, or a test case with step by step instructions, if that doesn't help.