Invalidate() not using data-sort orthogonal data

Invalidate() not using data-sort orthogonal data

andyovandyov Posts: 7Questions: 3Answers: 0

Hi,
I'm trying to update a cell's contents and set its data-sort attribute, and after doing so I call invalidate(). The search() then works as expected (i.e. I can then search for updated cell contents), but if I sort the data, it still sorts based on its content, rather than its data-sort attribute.

In the jsfiddle, click the 'click me' button, then sort by the last column, and it should use the number in brackets (which is what it's data-sort is set to), but instead uses the content itself.

My only guess is that I'm either calling invalidate on the wrong thing?

https://jsfiddle.net/24fubkmj/1/

Thanks for any help you can provide!

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,275Questions: 26Answers: 4,765
    Answer ✓

    According to the Orthogonal Data HTML5 docs:

    DataTables will automatically detect the following attributes on HTML cells:

    I believe this means the attributes need to be in the dom when Datatables initializes. Updated your example to show this:
    https://jsfiddle.net/wb9Ln5fk/

    Kevin

  • andyovandyov Posts: 7Questions: 3Answers: 0

    Ahh! perfect! Knew it would come down to something simple I missed!
    Thanks a lot :smile:

This discussion has been closed.