{hero}

columns.searchBuilder.defaultCondition

Since: SearchBuilder 1.4.0

Set a default condition for this column.
Please note - this property requires the SearchBuilder extension for DataTables.

Description

SearchBuilder uses this option to decide which option within the condition select should be initially selected when a user selects that column to filter. By default SearchBuilder will select the first item in the condition select, which is typically the condition title.

Types

number

Description:

When columns.searchBuilder.defaultCondition is set to a number it will select the option within the select at the corresponding index.

string

Description:

When columns.searchBuilder.defaultCondition is set to a string, it will select the option whose token is the same as this string. For example this will be "=", ">" etc. to avoid clashing with i18n changes.

Default

  • Value: undefined

The default value of columns.searchBuilder.defaultCondition is undefined. This means that by default the first option in the condition select will be selected.

Example

Set the condition to be '!=' for the third column:

new DataTable('#myTable', {
	columnDefs: [
		{
			targets: 2,
			searchBuilder: {
				defaultCondition: '!='
			}
		}
	],
	layout: {
		top1: 'searchBuilder'
	}
});

Related

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