Something like indexOf to use HTML5 data-filter attribute instead of cell content to locate a row
Something like indexOf to use HTML5 data-filter attribute instead of cell content to locate a row
I am trying to use indexOf to locate a cell that contains some text. The cell has the text wrapped in <a> tags and so indexOf returns -1. If I remove the <a> tags and just have the cell contain the text I'm searching for, it works fine.
I have added data-filter attributes to each <td> but indexOf doesn't seem to use them. Is there a way I can get it to, or some other way I can locate a specific row that has the text in the column I am looking for?
I am trying to locate the row index for the row I want so I can then draw the page that contains it. The JumpToData plug-in has the same issue, it won't find my row because of the <a> tags.
This question has an accepted answers - jump to answer
Answers
Use
cells().render()
rather thanrows().data()
(or any of the other*.data()
methods) if you want to get orthogonal data.e.g.:
Allan
Hi @darrenm ,
There's a lot going on there. We're happy to take a look, but it would help, as per the forum rules, if you could link to a running test case showing the issue so we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
Thanks Colin, I will make sure to do that in future. In this case though, Allan has nailed it, so thank you.