How to use TH values as labels for dropdown search
How to use TH values as labels for dropdown search
potato_code
Posts: 14Questions: 5Answers: 0
Hi,
I'm trying to get the column headers and use them as labels for the dropdown search. I've been able to append the search dropdown functionality to a Bootstrap Modal but I can't figure out the line of code. I've tried
$(this.table().header()).appendTo($('#test'));
which is not what I'm trying to achieve.
link to test case:
live.datatables.net/cumapapu/3/
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Use
column().header()
to get theth
html, like this:http://live.datatables.net/cumapapu/5/edit
Kevin
Hi,
Thanks for the reply but that's not what I was hoping to achieve. I was aiming for something like this for example:
where in the Bootstrap Modal there is two columns. The left is labels (ie: Name, Position, Office, etc) and the right column is the dropdown search select. Is this possible?
Since you are able to get the column data and the header name you will need to refer to the Bootstrap Modal docs to learn how to display the modal the way you want.
Kevin
Consider the SearchBuilder plugin. It satisfied my requirements in 5 lines of code.
https://datatables.net/extensions/searchbuilder/examples/initialisation/simple.html