Searching data-search attributes

Searching data-search attributes

koskos Posts: 5Questions: 2Answers: 0

Hello,
I have a table, where some columns contain only check mark icon and no other content. To make these cells searchable I added data-search attribute on each td with the name of the field. It works as expected, but only if there are enough cells that have the attribute.

I made a jsfiddle example here - http://jsfiddle.net/bcb4j22t/

If I search either rate, temp, location or manual it works fine, but if I search for position, there are no results, even tough there are two cells with data-search="position" attribute.

Any ideas, what am I doing wrong or is it a bug/intentional?

Thank you for help and awesome plugin :)

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    Answer ✓

    Hi,

    At the moment, DataTables uses only the first row in the table to detect if attributes should be used for ordering / searching. It would be possible to loop through every row and detect if the attributes are present, but this would be a massive performance drag, which is why it is implement in this manner.

    So to resolve the issue here, what you'll probably need to do is define data-search for each cell in the column - even if it is just an empty string.

    Allan

This discussion has been closed.