{hero}

columns.searchPanes.show

Since: SearchPanes 1.0.0

Force Panes to hide or show.
Please note - this property requires the SearchPanes extension for DataTables.

Description

As standard, SearchPanes will decide which columns to display a pane for by calculating a simple uniqueness ratio of unique values in that column to the total number of entries in the table. For example if there are 100 rows in a table, and in a certain column there are 10 unique options, then the ratio is 0.1.

If the calculated value is less than the default threshold for all of the panes then this column will have a pane (assuming that the threshold has not been altered for all or an individual pane by either searchPanes.threshold or columns.searchPanes.threshold).

The columns.searchPanes.show option is useful for removing this calculation from the process and effectively forcing a pane to either be shown or hidden.

The example forces a pane to be displayed for the first column and the pane for the third column to be hidden.

Type

boolean

Description:

By setting the columns.searchPanes.show option to true for a column, a pane for that column will be shown even if the threshold calculations would reject it.

Equally, by setting the init columns.searchPanes.show option to be false for a column, a pane for that column will not be shown regardless of the threshold calculations.

Default

  • Value: undefined

The default value for the searchPanes.show parameter is undefined. When this default value is in place, the internal calculations and validation will decide whether a pane should be shown for that column. See searchPanes.threshold and columns.searchPanes.threshold to alter these calculations.

Example

Force panes to hide and show:

new DataTable('#myTable', {
	layout: {
		top1: 'searchPanes'
	},
	columnDefs: [
		{
			searchPanes: {
				show: true
			},
			targets: [0]
		},
		{
			searchPanes: {
				show: false
			},
			targets: [2]
		}
	]
});

Related

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