0

I would like to sort my datable on the style background . It is possible? How ?

<td class="sorting_1" style="background: red;"></td>
<td class="sorting_1" style="background: white;"></td>

EDIT : i add a attribute data-order and i would like to filter on it :

  <td class="sorting_1" data-order="red" style="background: red;"></td>
   <td class="sorting_1" data-order="white" style="background: white;"></td>

My dataTable has 5 columns and i want to filter on the five : "aoColumns": [ {}, {}, {}, {}, {targets: 0, "data": { _: "0.display", sort: "0.@data-order", type: "0.@data-order" } } ]

I have an error message.. Any Idea?

dev75
  • 1
  • 2
  • Welcome to StackOverflow. Please visit the [help center](https://stackoverflow.com/help), take the [tour](https://stackoverflow.com/tour) to see what and [How to Ask](https://stackoverflow.com/help/how-to-ask). Do some research, search for related topics on SO; if you get stuck, post a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) of your attempt, noting input and expected output. – Alexandre Elshobokshy Jan 23 '19 at 14:06
  • What do you mean by sorting ? Do you mean organised by colors ? Blue background td next to blue background td and red background td next to red background td ? – Saraband Jan 23 '19 at 14:08
  • When using https://datatables.net/ you can add data-order attribute and place the value you want to sort by. In this case, the background color: data-order="red" or data-order="white"... – daddygames Jan 23 '19 at 14:09
  • more information -> https://stackoverflow.com/questions/17806737/custom-sorting-of-jquery-datatable-columns – daddygames Jan 23 '19 at 14:11
  • @daddygames i added a attribute data-order and i would like to filter on it : My dataTable has 5 columns and i want to filter on the five : "aoColumns": [ {}, {}, {}, {}, {targets: 0, "data": { _: "0.display", sort: "0.@data-order", type: "0.@data-order" } } ] I have an error message.. Any Idea? – dev75 Jan 23 '19 at 17:04

0 Answers0