{hero}

searchBuilder.preDefined

Since: SearchBuilder 1.0.0

Set a predefined search query.
Please note - this property requires the SearchBuilder extension for DataTables.

Description

This parameter provides the ability to set arbitrary complex search terms that should be applied to a DataTable. It is made up of a SearchBuilder.Criteria object that allows nested data.

For more information on how all of the configuration options for predefined searches are brought together, please refer to the manual page for predefined searches.

Types

SearchBuilder.Criteria

Description:

Search condition object.

boolean

Description:

When false no predefined search is applied.

Default

  • Value: false

The default value for this option is false meaning that as standard there will be no predefined search applied.

Examples

Simple single level search:

new DataTable('#myTable', {
	layout: {
		top1: {
			searchBuilder: {
				preDefined: {
					criteria: [
						{
							condition: '=',
							data: 'Office',
							value: ['Edinburgh']
						}
					],
					logic: 'AND'
				}
			}
		}
	}
});

More Complex Multi level search:

new DataTable('#myTable', {
	layout: {
		top1: {
			searchBuilder: {
				preDefined: {
					criteria: [
						{
							condition: '=',
							data: 'Office',
							value: ['Edinburgh']
						},
						{
							criteria: [
								{
									condition: '=',
									data: 'Name',
									value: ['Cedric Kelly']
								},
								{
									condition: '=',
									data: 'Name',
									value: ['Dai Rios']
								}
							],
							logic: 'OR'
						}
					],
					logic: 'AND'
				}
			}
		}
	}
});

Simple single level search suitable for SSP:

new DataTable('#myTable', {
	layout: {
		top1: {
			searchBuilder: {
				preDefined: {
					criteria: [
						{
							condition: '=',
							data: 'Office',
							origData: 'office',
							type: 'string',
							value: ['Edinburgh']
						}
					],
					logic: 'AND'
				}
			}
		}
	}
});

Related

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