How do I modify the data-search of a dynamically modified cell?
How do I modify the data-search of a dynamically modified cell?
I have a cell whose content I am modifying using jquery's .text() method on a span element inside it, and that has a data-search attribute set. After updating the content, however, the data-search remains the same and I cannot search using the new content. What is it I'm doing wrong and how can I fix this? My test case is at http://live.datatables.net/dujuyilo/2/edit . Thanks in advance.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I am actually searching the same thing at the moment. I am using homegrown inline editing.
You need to 'invalidate' the stored data that DataTables has using
row().invalidate()
- for example: http://live.datatables.net/dujuyilo/3/edit .Allan
This solution didn't work as I had it, using the .data method on the row, but when I changed it from data('search' ... to .attr('data-search ... , it did. For the benefit of anyone else who encounters this thread. Thank you very much!
Oops, forgot the link to the modified code: http://live.datatables.net/dujuyilo/4/edit