{hero}

searchBuilder.preDefined.criteria.condition

Since: SearchBuilder 1.0.0

Define the condition to be selected.
Please note - this property requires the SearchBuilder extension for DataTables.

Description

This option is used as part of SearchBuilder's ability to programmatically preset filters, which is done with the searchBuilder.preDefined option. This option specified the condition that the filter should use. This is done by setting the condition property of one of the objects on the searchBuilder.preDefined.criteria array to one of the keys listed below.

The following keys are used to represent the conditions.

  • For the string and html column types
    • != - "Not"
    • !null - "Not Empty"
    • = - "Equals"
    • contains - "Contains"
    • !contains - "Does Not Contain With"
    • ends - "Ends With"
    • !ends - "Does Not End With"
    • null - "Empty"
    • starts - "Starts With"
    • !starts - "Does Not Start With"
  • For the num, num-fmt, html-num and html-num-fmt column types
    • != - "Not"
    • !null - "Not Empty"
    • < - "Less Than"
    • <= - "Less Than Equal To"
    • = - "Equals"
    • > - "Greater Than"
    • >= - "Greater Than Equal To"
    • between - "Between"
    • !between - "Not Between"
    • null - "Empty"
  • For the date, moment and luxon column types
    • != - "Not"
    • !null - "Not Empty"
    • < - "Before"
    • = - "Equals"
    • > - "After"
    • between - "Between"
    • !between - "Not Between"
    • null - "Empty"
  • For the array column type
    • contains - "Contains"
    • without - "Without"
    • = - "Equals"
    • != - "Not Equals"
    • null - "Empty"
    • !null - "Not Empty"

Please refer to the searchBuilder.preDefined documentation or or the manual page for more details.

Type

string

Description:

The string representing the condition to be selected. This should be one of the keys listed above.

Default

  • Value: undefined

The default value for the searchBuilder.preDefined.criteria.condition option is undefined meaning that if this is not defined then it is impossible to apply a value to this criteria.

Example

Defining Equals for a condition:

$('#example').DataTable( {
	dom: 'Qlfrtip',
	searchBuilder: {
		preDefined: {
			criteria:[
				{
					condition: '=',
					data: 'Office',
					value: ['Edinburgh']
				}
			],
			logic: 'AND'
		}
	}
});

Related

The following options are directly related and may also be useful in your application development.