{hero}

searchPanes.preSelect

Since: SearchPanes 2.0.0

Pre-selected options in a pane.
Please note - this property requires the SearchPanes extension for DataTables.

Description

As standard, SearchPanes will not pre-select any values in any of the panes.

The objects stored within this array contain 2 values.

  • column number - The column index for the pane where these selections are to be made.
  • rows string[] - An array of strings that contain the filter values of the rows that are to be selected within the corresponding pane.

If any of the elements in the array held in searchPanes.preSelect.rows are present in the pane then they will be pre-selected.

This option replaces the deprecated columns.searchPanes.preSelect option. In this format it is now possible to set the order in which selections are made. This means that preSelect is now compatible with searchPanes.cascadePanes.

To make preselections in custom panes, the searchPanes.preSelect.column value should be set to the sum of the last column's index, and the number of custom pane this is. For example if the last column index was 5, and the selection was to be made in the second custom pane then the value of searchPanes.preSelect.column should be set to 7.

Type

Array

Description:

searchPanes.preSelect is an array of objects that contain the details required to preselect rows in the corresponding panes.

Default

  • Value: []

The default value for the searchPanes.preSelect parameter is []. When this default value is in place, no values will be preSelected in the panes.

Example

Pre-select values in a pane:

new DataTable('#myTable', {
	layout: {
		top1: {
			searchPanes: {
				preSelect: [
					{
						column: 3,
						rows: ['Edinburgh', 'London']
					}
				]
			}
		}
	}
});