Get HTML search data from column().data()

Get HTML search data from column().data()

theWizardtheWizard Posts: 5Questions: 1Answers: 0

Hi,

For HTML columns I use the "HTML plugin" to extend the search with this type.
In this column there are mainly links with a tags.

My idea is to get all the values from this column and get the unique values based on the text withint the a tags.
The HTML plugin forsees that this data can be used in the search scenario, but when I want to fetch that data from the column it is still the original HTML data.

Which is the best way to retrieve the data from the column wich is also used within the search?

Thanks in advance

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,214Questions: 1Answers: 10,415 Site admin

    The cell().render() method with the parameter passed in as 'search' will give you the data DataTables uses for searching.

    Allan

  • theWizardtheWizard Posts: 5Questions: 1Answers: 0

    Thanks for the quick response allan, but I'm still not able to get it to work.
    When intializing the table, my breakpoints get hit in the plugin and the correct data is being fetched for the search. But when I try to fetch it with the cell render I keep getting the full html value. I made a small example to illustrate my problem. Is there something that I am missing? I also tried to explicitly set the datatype of the column to html, but that didn't make any difference.

    http://live.datatables.net/sitowedu/1/edit

  • allanallan Posts: 63,214Questions: 1Answers: 10,415 Site admin
    Answer ✓

    Ooops - sorry - giving you duff information... The cell().render() information will get the filter information - but it is not passed through the search formatter! Hence why it doesn't work.

    The cell().cache() method however will: http://live.datatables.net/sitowedu/2/edit (note that you need to use search in this case rather than filter...).

    You also don't need the html search type plug-in - DataTables does it automatically.

    Allan

  • theWizardtheWizard Posts: 5Questions: 1Answers: 0

    No problem allan, thanks this is just what I needed!

This discussion has been closed.