Get class from rendered data

Get class from rendered data

birobiro Posts: 12Questions: 7Answers: 0

i made a Table that uses Datatables as plugin for managing all the table functions (sorting, searching, etc) i got a "NOTE" fields that is renderend adding extra html to the text, like

NOTE FIELD (ORIGINAL): "Hello"
NOTE FIELD (RENDERED): "<span class='fancyClass'>Hello</span>"

everything works fine, but i'd like to filter the table to all the elements in the table where "fancyClass" exists.

I've been trying with several solutions, like simple click event on the button that has to perform the search, istantiating the click event on the the "initComplete" event of the datatables and so on. the problem is that every path i took, gaves me the same original text, with no HTML, or class. i've tried iterating rows, columns or either cells, with data() or renderer(), with no luck.

anyone got tips?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Answer ✓

    DataTables will strip the HTML by default since normally developers don't want their users to be searching by hidden information.

    But if you want to force it to sort on the HTML as well you can set the columns.type option for that column to be string.

    Allan

This discussion has been closed.