I have a table (using datatables framwork) which contains in a column tag. I mean that content of this columns looks like this:
<td>
<select class="form-control attendance_select" data-id_player="130">
<option value="-1">No</option>
<option value="0" selected="">No answer</option>
<option value="1">Yes</option>
</select>
</td>
When I use yadcf column filter and try to search only columns wih "Yes" as selected options in this select, it doesn't work because every rows contains "Yes" in html code.
Can you please help me, how to set yadcf for solving this issue if it's possible?
Thank you
You probably need to define filter type "custom_func" and specify a custom filter function for your column.
From inline docs: (reformatted explanation )
custom_func
Required: true, when filter_type is custom_func
Type: function
Default value: undefined
Description: should be pointing to a function with the following signature
function myCustomFilterFunction(filterVal, columnVal, rowValues, stateVal) {
}
where
filterVal
: is the value from the select box,columnVal
is the value from the relevant row column,rowValues
is an array that holds the values of the entire row andstateVal
which holds the current state of the table row DOM
, stateVal is perfect to handle situations in which you placing radiobuttons / checkbox inside table column (should be suitable for your case ofselect
.
This function should return true if the row matches your condition and the row should be displayed) and false otherwise.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With