Extracting HTML5 data-* values to populate select input based filters
Extracting HTML5 data-* values to populate select input based filters
Hi,
Thank you for the wonderful dataTables!
I would love to know how to extract the values from the data-search
/data-filter
(HTML5 data-* attributes) properties of a cell to populate a select dropdown based filter. The actual cell contains few HTML elements which I don't want the dropdown to be filled with.
To understand the requirement, kindly check http://jsfiddle.net/codecanvas/9xcLjx11/
As you can see, the selects values do not show up properly as the cells have img
tags in them, and the td
has the proper data-search
attributes for searching purpose.
Thank you in advance.
This question has an accepted answers - jump to answer
Answers
You would use
columns().nodes()
to get the cell nodes and then loop over them to read their attributes and create the required array.Allan
Thank you Allan!
For future browsers of this page, the solution based on the answer is available at http://jsfiddle.net/codecanvas/9xcLjx11/3/