I want to filter my ID’s, which are are numbers and I have an input that is outside of the table. But I want to use the =, >,<,>=, and <= search criteria for numbers
Is there a way to use the numberFilter in a custom input?
I have a select that returns column id’s so I know what column they want to search, but if the column has numbers in it, I want to give them the ability to search by >, <, =, >=, and <=
So ideally the number filter that has that built in logic could be used. I just want it outside of the header.
Hmmmmmm is it possible to hide the built in numberFilter input with css, pass a val() to that input and fire off the keydown event? Problem is I cant seem to simulate a keydown event.
The filter function runs through all the data in the column with a for loop. It then looks for true or false. Any value that was true gets displayed in the column.
So if it is looking for true or false, we can easily use and if statement to check for conditions we want, and return true or false.
-------obj[colId] = the value in the cell, under my specified column---
-------userInputOperator = ">","<","==",">=", or "<="-------------
-------userInputNumber = the val() of the input -------------------
datatable.filter(function(obj){
var evaluatedStatement = obj[colId] + userInputOperator + userInputNumber;
if (eval(evaluatedStatement)) {return true} else {return false};
});