searchBuilder.conditions[type][cond].inputValue
Function to get the values that are to be used in the comparisons.
Please note - this property requires the SearchBuilder extension for DataTables.
Description
This function is a getter. It returns an array of values that are to be used to compare against the data in the table. It takes 2 parameters.
el
the array of value elements that belong to this criteria.that
Optional. The criteria instance that is being used.
The values that are returned here will be passed into the searchBuilder.conditions[type][cond].search
function. Typically these will be taken from the elements that the searchBuilder.conditions[type][cond].init
function created, although this may be different for some conditions such as empty
.
The searchBuilder.conditions[type][cond].inputValue
is in a separate function rather than running it all in the searchBuilder.conditions[type][cond].search()
. This makes searching more efficient as the values only need to be collected from the jQuery elements once this way.
The manual page for custom conditions covers in detail how this and the other values in this object come together to create a custom condition.
Note: Please also not that custom conditions are not supported when the serverSide
option is set to true.
Some examples for select and input elements are shown below.
Type
Examples
Select inputValue function:
...
inputValue (el) {
// Extract the selected value from the select element
return [$(el[0]).children('option:selected').val()];
}
...
Input inputValue function:
...
inputValue (el) {
// Extract the value in the input element
return [$(el[0]).val()];
}
...
Related
The following options are directly related and may also be useful in your application development.