Sort div object within a datatable

Sort div object within a datatable

rrzavaletarrzavaleta Posts: 78Questions: 52Answers: 2

Good morning.

Actually I am checking a table that in one of its columns returns a div from the data of the column.A semaphore (red, green, yellow)
something like that:
  {"width": "2%", "searchable": true, "visible": true, "data": "colorSemaforoString", "render": function (data, type, row) {
                 return "

<

div id = 'Correct' class = 'col-md-offset-4 semaforocircle' style = 'background:" + row.colorSemaphore + ";'> </ div>";
             }},

Where row.colorSemaphore, is an exadecimal color.
Where colorSemaphoreString, is the color-string (red, green, yellow)

When I click on the column where the div is drawn, it is not ordered

How can I order the div in datatable?

This question has an accepted answers - jump to answer

Answers

  • rrzavaletarrzavaleta Posts: 78Questions: 52Answers: 2
    Answer ✓

    I have been able to achieve the behavior I want.
    I just had to add a tag "span" oculata and it allows me to sort the content

    {"width": "2%", "searchable": true, "visible": true, "data": "colorSemaforoString", "render": function (data, type, row) {
    return '<span hidden>'+data+'</span>'+"

    ";
    }},

This discussion has been closed.