{hero}

searchPanes.panes.preSelect

Since: SearchPanes SearchPanes 1.0.0

Deprecated. Define any preSelections for the custom panes.
Please note - this property requires the SearchPanes extension for DataTables.

Description

This option is deprecated from version 2.0.0+. It was replaced by searchPanes.preSelect which allowed the order that the selections were made in to be defined. This allowed preselecting to become compatible with searchPanes.cascadePanes

As standard, Custom panes have no preSelected options.

Setting searchPanes.panes.preSelect to contain strings that match the value of an options searchPanes.panes.options.label will allow SearchPanes to select that option for preSelection.

Note: Before version 2.0.0 where this option was deprecated, searchPanes.panes.preSelect was not supported with searchPanes.cascadePanes. This was because in order to have the cascade operate as expected the selections has to be made in the correct order. It is however now in versions after 2.0.0 using searchPanes.preSelect.

Type

Array

Description:

The searchPanes.panes.preSelect array allows custom options to be preSelected for Custom Panes. The array is to be populated with strings that match the searchPanes.panes.options.label string.

Default

  • Value: Undefined

The default value of searchPanes.panes.preSelect is undefined as by default there should be no preSelected options.

Example

PreSelect 'Over 50' custom pane option:

$(document).ready(function() {
    $('#example').DataTable({
        searchPanes: {
            panes: [
                {
                    header: 'Age Range',
                    options: [
                        {
                            label: 'Over 50',
                            value: function(rowData, rowIdx) {
                                return rowData[3] > 50;
                            }
                        },
                        {
                            label: 'Under 50',
                            value: function(rowData, rowIdx) {
                                return rowData[3] < 50;
                            }
                        }
                    ],
                    preSelect: ['Over 50']
                }
            ]
        },
        dom: 'Plfrtip'
    });
});

Related

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