I'm trying to use a custom filter on one of my columns and to do the filtering programmatically. I have managed to call the custom filter but the filterVal prints as null. Code below:
Calling the filter:
yadcf.exFilterColumn(theTable, [[4, "Value To Filter On"]]);
The filter itself - I'm just returning true for now to test the actual calling of the filter:
function numberFilter(filterVal, columnVal, rowValues, stateVal) {
console.log(filterVal)
return true;
}
The console.log line prints out null
instead of "Value to Filter On"
.
Am I missing something or is customFunc even supported with exFilterColumn?
It wasn't working because you tried to filter with value that is not present in the filter values, in addition notice that you have used html elements in the column which resulted in html elements in the filter itself,
Here is the modified code for filter
$("#value-filter").on('input', function () {
console.log(this.value);
yadcf.exFilterColumn(theTable, [[0, 50]]);
})
and updated column data
<tr>
<td>
500
</td>
</tr>
<tr>
<td>
200
</td>
</tr>
<tr>
<td>
50
</td>
</tr>