Define custom conditions for SearchBuilder.
Please note - this property requires the SearchBuilder extension for DataTables.
This option allows custom conditions to be added to SearchBuilder, to extend or replace the standard ones.
string- Column type for strings. This is also the default should none of the below types match the data in the column.
num- Simple numbers with no formatting
num-fmt- Numbers with formatting such as currency.
html- Basic strings that also make use of html tags
html-num- Basic numbers that also make use of html tags.
html-num-fmt- Numbers with formatting that also make use of html tags
momentFormatted dates. This is used in combination with the DataTables Ultimate Sorting Plug-in.
luxonFormatted dates. This is used in combination with the DataTables Ultimate Sorting Plug-in for luxon
arrayThe array type is used in combination with
columns.orthogonaldata and provides better conditions for columns that use arrays. This is not automatically identified, the
columns.typemust be set to
arrayfor these to be used.
- It is also possible to add your own custom types. Using the
columns.typeinitialisation option and adding a property of the same type name in this object. You can define your own conditions for custom types either through a plug in, or initialisation.
The standard conditions can be removed, edited or added to. The manual page for custom conditions covers this in detail.
Note: When using a custom decimal place character, the SearchBuilder internals will replace this with a
. so that the correct processing can take place. It is worth bearing this in mind when customising the functions that each condition runs.
Note: Please also not that custom conditions are not supported when the
serverSide option is set to true.
There are two examples that create custom conditions using initialisation options. They both show how to add a custom condition to the
num column type, but the process is the same for other column types.
There is also an example that shows how to use a plug-in to add a custom condition.
An object that contains conditions for each of the built in DataTables types as defined in
luxontypes for formatted dates, an
arraytype for columns with an array format and any other custom types that may exist on the table.
The default value for the
searchBuilder.conditions option is an object with a property for each of the built in DataTables types as defined in
columns.type along with
luxon types for formatted dates, an
array type for columns with an
array format and any other custom types that may exist on the table. Each property in turn is an object with key value pairs to represent the conditions. These objects have the structure of
The following options are directly related and may also be useful in your application development.