{hero}

searchPanes.panes.preSelect

Since: SearchPanes SearchPanes 1.0.0

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

Description

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: searchPanes.panes.preSelect is not supported with searchPanes.cascadePanes. This is because in order to have the cascade operate as expected the selections need to be made in the correct order. Currently it is not possible to indicate this with 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.