How to filter a column with input and select element values.
How to filter a column with input and select element values.
Hello,
I have a datatable with 2 columns: Column A contains ids as simple text and Column B contains labels, inputs and select elements. The "input" elements contains
| Id | Data |
| T1-1 | name: <input ....value = "John" /> |
| | job: <select.... option="Cook"/> |
| T1-2 | name: <input ....value = "Tim" /> |
| | job: <select.... option="Waiter"/> |
| T1-1 | name: <input ....value = "Kat"/> |
| | job: <select.... option="Waiter"/> |
Using the default "Filter..." element, I am able to filter the datatable with the Ids: E.g. filter "T1-1" gives me rows 1 and 3. However, I'm not able to filter the table using the sting values of the selects or the inputs from the 2nd column. For example, if I filter with "Waiter" nothing happens.
Do you have a suggestion on how to extend the "Filter" to perform searches with the selects and input element values?
Thank you,
Greg
Answers
You can try my yadcf plugin and its
filter_type: 'custom_func',
you will have to read in the docs about its usage / function signature/etc , you might need to make sure that your select inputs will update the "model" of datatables when they are changed (not sure of needed),see showcase (first column) note that the showcase does not show the full potential of the filter - so read docs...
Thank you for the comment. However, I cannot use this plugin in product code.