Configuration searchPanel

    Specifies options of the search panel.

    Type: Object

    A search panel is a grid element that allows the user to search grid records by a search string. Searching performs in those grid columns that have the allowFiltering option set to true.

    The search panel is located in the upper-right corner of the DataGrid widget. To make it visible, set the visible property of the searchPanel configuration object to true.

    See Also
    • To discover how to configure the search panel, see the Search Panel topic.
    • For more information about searching, refer to the Searching topic.

    Also, you can search grid records by a search string from code. Call the searchByText(text) method to do this.

    View Demo

    Show Example:
    AngularJS
    Knockout
    jQuery

    In this example, the search panel is made visible using the visible option of the searchPanel object. Additionally, its width is changed using the width option of the same object.

    <div ng-controller="demoController">
        <div style="height:390px; max-width:630px; margin: 0 auto" dx-data-grid="{
            dataSource: orders,
            columns: columns,
            paging: { pageSize: 7 },
            searchPanel: {
                visible: true,
                width: 250
            }
        }"></div>
    </div>
    
    var myApp = angular.module('myApp', ['dx']);
    myApp.controller("demoController", function ($scope) {
        $scope.orders = orders;
        $scope.columns = [
            'OrderID', 'CustomerID',
            { dataField: 'OrderDate', dataType: 'date' },
            { dataField: 'ShippedDate', dataType: 'date' },
            'ShipName',
            { dataField: 'ShipCountry', caption: 'Ship To' }
        ];
    });
    angular.element(document).ready(function () {
        angular.bootstrap(document, ['myApp']);
    });
    

    In this example, the search panel is made visible using the visible option of the searchPanel object. Additionally, its width is changed using the width option of the same object.

    <div style="height:390px; max-width:630px; margin: 0 auto" data-bind="dxDataGrid: {
        dataSource: orders,
        columns: columns,
        paging: { pageSize: 7 },
        searchPanel: {
            visible: true,
            width: 250
        }
    }"></div>
    
    var myViewModel = {
        orders: orders,
        columns: [
            'OrderID', 'CustomerID',
            { dataField: 'OrderDate', dataType: 'date' },
            { dataField: 'ShippedDate', dataType: 'date' },
            'ShipName',
            { dataField: 'ShipCountry', caption: 'Ship To' }
        ]
    }
    ko.applyBindings(myViewModel);
    

    In this example, the search panel is made visible using the visible option of the searchPanel object. Additionally, its width is changed using the width option of the same object.

    <div id="gridContainer" style="height:390px; max-width:630px; margin: 0 auto"></div>
    
    $(function () {
        $("#gridContainer").dxDataGrid({
            dataSource: orders,
            columns: [
                'OrderID', 'CustomerID',
                { dataField: 'OrderDate', dataType: 'date' },
                { dataField: 'ShippedDate', dataType: 'date' },
                'ShipName',
                { dataField: 'ShipCountry', caption: 'Ship To' }
            ],
            paging: { pageSize: 7 },
            searchPanel: {
                visible: true,
                width: 250
            }
        });
    });
    

    highlightSearchText

    Specifies whether or not search strings in the located grid records should be highlighted.

    Type: Boolean
    Default Value: true

    Show Example:
    AngularJS
    Knockout
    jQuery

    In this example, you can change the value of the searchPanel | highlightSearchText option using the check box under the grid. Type something in the search panel and see the changes.

    <div ng-controller="demoController" style="text-align:center; height:410px; max-width:630px; margin: 0 auto">
        <div style="height:380px" dx-data-grid="{
            dataSource: orders,
            columns: columns,
            paging: { pageSize: 7 },
            searchPanel: {
                visible: true,
                highlightSearchText: true
            },
            bindingOptions: {
                'searchPanel.highlightSearchText': 'checkBoxState'
            }
        }"></div>
        <div ng-model="checkBoxState" dx-check-box="{
            text: 'Highlight Search Text'
        }"></div>
    </div>
    
    var myApp = angular.module('myApp', ['dx']);
    myApp.controller("demoController", function ($scope) {
        $scope.orders = orders;
        $scope.columns = [
            'OrderID', 'CustomerID',
            { dataField: 'OrderDate', dataType: 'date' },
            { dataField: 'ShippedDate', dataType: 'date' },
            'ShipName',
            { dataField: 'ShipCountry', caption: 'Ship To' }
        ];
        $scope.checkBoxState = true;
    });
    angular.element(document).ready(function () {
        angular.bootstrap(document, ['myApp']);
    });
    

    In this example, you can change the value of the searchPanel | highlightSearchText option using the check box under the grid. Type something in the search panel and see the changes.

    <div style="text-align:center; height:410px; max-width:630px; margin: 0 auto">
        <div style="height:380px" data-bind="dxDataGrid: {
            dataSource: orders,
            columns: columns,
            paging: { pageSize: 7 },
            searchPanel: {
                visible: true,
                highlightSearchText:  checkBoxState
            }
        }"></div>
        <div data-bind="dxCheckBox: {
            text: 'Highlight Search Text',
            value: checkBoxState
        }"></div>
    </div>
    
    var myViewModel = {
        orders: orders,
        columns: [
            'OrderID', 'CustomerID',
            { dataField: 'OrderDate', dataType: 'date' },
            { dataField: 'ShippedDate', dataType: 'date' },
            'ShipName',
            { dataField: 'ShipCountry', caption: 'Ship To' }
        ],
        checkBoxState: ko.observable(true)
    }
    ko.applyBindings(myViewModel);
    

    In this example, you can change the value of the searchPanel | highlightSearchText option using the check box under the grid. Type something in the search panel and see the changes.

    <div style="text-align:center; height:410px; max-width:630px; margin: 0 auto">
        <div id="gridContainer" style="height:380px;"></div>
        <div id="highlightSearchTextCheckbox"></div>
    </div>
    
    $(function () {
        $("#gridContainer").dxDataGrid({
            dataSource: orders,
            columns: [
                'OrderID', 'CustomerID',
                { dataField: 'OrderDate', dataType: 'date' },
                { dataField: 'ShippedDate', dataType: 'date' },
                'ShipName',
                { dataField: 'ShipCountry', caption: 'Ship To' }
            ],
            paging: { pageSize: 7 },
            searchPanel: {
                visible: true,
                highlightSearchText: true
            }
        });
    
        $("#highlightSearchTextCheckbox").dxCheckBox({
            text: 'Highlight Search Text',
            value: true,
            onValueChanged: function (e) {
                $('#gridContainer').dxDataGrid('instance').option("searchPanel.highlightSearchText", e.value);
            }
        });
    });
    

    placeholder

    Specifies text displayed by the search panel when no search string was typed.

    Type: String
    Default Value: 'Search...'

    Show Example:
    AngularJS
    Knockout
    jQuery

    In this example, the text displayed by an empty search panel is changed using the searchPanel | placeholder option.

    <div ng-controller="demoController">
        <div style="height:390px; max-width:630px; margin: 0 auto" dx-data-grid="{
            dataSource: orders,
            columns: columns,
            paging: { pageSize: 7 },
            searchPanel: {
                visible: true,
                width: 250,
                placeholder: 'Type something here...'
            }
        }"></div>
    </div>
    
    var myApp = angular.module('myApp', ['dx']);
    myApp.controller("demoController", function ($scope) {
        $scope.orders = orders;
        $scope.columns = [
            'OrderID', 'CustomerID',
            { dataField: 'OrderDate', dataType: 'date' },
            { dataField: 'ShippedDate', dataType: 'date' },
            'ShipName',
            { dataField: 'ShipCountry', caption: 'Ship To' }
        ];
    });
    angular.element(document).ready(function () {
        angular.bootstrap(document, ['myApp']);
    });
    

    In this example, the text displayed by an empty search panel is changed using the searchPanel | placeholder option.

    <div style="height:390px; max-width:630px; margin: 0 auto" data-bind="dxDataGrid: {
        dataSource: orders,
        columns: columns,
        paging: { pageSize: 7 },
        searchPanel: {
            visible: true,
            width: 250,
            placeholder: 'Type something here...'
        }
    }"></div>
    
    var myViewModel = {
        orders: orders,
        columns: [
            'OrderID', 'CustomerID',
            { dataField: 'OrderDate', dataType: 'date' },
            { dataField: 'ShippedDate', dataType: 'date' },
            'ShipName',
            { dataField: 'ShipCountry', caption: 'Ship To' }
        ]
    }
    ko.applyBindings(myViewModel);
    

    In this example, the text displayed by an empty search panel is changed using the searchPanel | placeholder option.

    <div id="gridContainer" style="height:390px; max-width:630px; margin: 0 auto"></div>
    
    $(function () {
        $("#gridContainer").dxDataGrid({
            dataSource: orders,
            columns: [
                'OrderID', 'CustomerID',
                { dataField: 'OrderDate', dataType: 'date' },
                { dataField: 'ShippedDate', dataType: 'date' },
                'ShipName',
                { dataField: 'ShipCountry', caption: 'Ship To' }
            ],
            paging: { pageSize: 7 },
            searchPanel: {
                visible: true,
                width: 250,
                placeholder: 'Type something here...'
            }
        });
    });
    

    searchVisibleColumnsOnly

    Specifies whether to search all columns or only visible ones.

    Type: Boolean
    Default Value: false

    By default, the widget searches the string entered into the search panel among all columns configured in the columns array. Some of them may be invisible, and finding a result in such columns may confuse the end-user. To avoid this situation, set the searchVisibleColumnsOnly option to true.

    text

    Sets a search string for the search panel.

    Type: String
    Default Value: ''

    Show Example:
    AngularJS
    Knockout
    jQuery

    In this example, the search string is specified initially using the searchPanel | text option.

    <div ng-controller="demoController">
        <div style="height:390px; max-width:630px; margin: 0 auto" dx-data-grid="{
            dataSource: orders,
            columns: columns,
            paging: { pageSize: 7 },
            searchPanel: {
                visible: true,
                text: 'Brazil'
            }
        }"></div>
    </div>
    
    var myApp = angular.module('myApp', ['dx']);
    myApp.controller("demoController", function ($scope) {
        $scope.orders = orders;
        $scope.columns = [
            'OrderID', 'CustomerID',
            { dataField: 'OrderDate', dataType: 'date' },
            { dataField: 'ShippedDate', dataType: 'date' },
            'ShipName',
            { dataField: 'ShipCountry', caption: 'Ship To' }
        ];
    });
    angular.element(document).ready(function () {
        angular.bootstrap(document, ['myApp']);
    });
    

    In this example, the search string is specified initially using the searchPanel | text option.

    <div style="height:390px; max-width:630px; margin: 0 auto" data-bind="dxDataGrid: {
        dataSource: orders,
        columns: columns,
        paging: { pageSize: 7 },
        searchPanel: {
            visible: true,
            text: 'Brazil'
        }
    }"></div>
    
    var myViewModel = {
        orders: orders,
        columns: [
            'OrderID', 'CustomerID',
            { dataField: 'OrderDate', dataType: 'date' },
            { dataField: 'ShippedDate', dataType: 'date' },
            'ShipName',
            { dataField: 'ShipCountry', caption: 'Ship To' }
        ]
    }
    ko.applyBindings(myViewModel);
    

    In this example, the search string is specified initially using the searchPanel | text option.

    <div id="gridContainer" style="height:390px; max-width:630px; margin: 0 auto"></div>
    
    $(function () {
        $("#gridContainer").dxDataGrid({
            dataSource: orders,
            columns: [
                'OrderID', 'CustomerID',
                { dataField: 'OrderDate', dataType: 'date' },
                { dataField: 'ShippedDate', dataType: 'date' },
                'ShipName',
                { dataField: 'ShipCountry', caption: 'Ship To' }
            ],
            paging: { pageSize: 7 },
            searchPanel: {
                visible: true,
                text: 'Brazil'
            }
        });
    });
    

    visible

    Specifies whether the search panel is visible or not.

    Type: Boolean
    Default Value: false

    Show Example:
    AngularJS
    Knockout
    jQuery

    In this example, you can change the visibility of the search panel at runtime using the check box located below the grid.

    <div ng-controller="demoController" style="text-align:center; height:410px; max-width:630px; margin: 0 auto">
        <div style="height:380px" dx-data-grid="{
            dataSource: orders,
            columns: columns,
            paging: { pageSize: 7 },
            searchPanel: { visible: true },
            bindingOptions: {
                'searchPanel.visible': 'checkBoxState'
            }
        }"></div>
        <div ng-model="checkBoxState" dx-check-box="{
            text: 'Show Search Panel'
        }"></div>
    </div>
    
    var myApp = angular.module('myApp', ['dx']);
    myApp.controller("demoController", function ($scope) {
        $scope.orders = orders;
        $scope.columns = [
            'OrderID', 'CustomerID',
            { dataField: 'OrderDate', dataType: 'date' },
            { dataField: 'ShippedDate', dataType: 'date' },
            'ShipName',
            { dataField: 'ShipCountry', caption: 'Ship To' }
        ];
        $scope.checkBoxState = true;
    });
    angular.element(document).ready(function () {
        angular.bootstrap(document, ['myApp']);
    });
    

    In this example, you can change the visibility of the search panel at runtime using the check box located below the grid.

    <div style="text-align:center; height:410px; max-width:630px; margin: 0 auto">
        <div style="height:380px" data-bind="dxDataGrid: {
            dataSource: orders,
            columns: columns,
            paging: { pageSize: 7 },
            searchPanel: { visible: checkBoxState }
        }"></div>
        <div data-bind="dxCheckBox: {
            text: 'Show Search Panel',
            value: checkBoxState
        }"></div>
    </div>
    
    var myViewModel = {
        orders: orders,
        columns: [
            'OrderID', 'CustomerID',
            { dataField: 'OrderDate', dataType: 'date' },
            { dataField: 'ShippedDate', dataType: 'date' },
            'ShipName',
            { dataField: 'ShipCountry', caption: 'Ship To' }
        ],
        checkBoxState: ko.observable(true)
    }
    ko.applyBindings(myViewModel);
    

    In this example, you can change the visibility of the search panel at runtime using the check box located below the grid.

    <div style="text-align:center; height:410px; max-width:630px; margin: 0 auto">
        <div id="gridContainer" style="height:380px;"></div>
        <div id="showSearchPanelCheckbox"></div>
    </div>
    
    $(function () {
        $("#gridContainer").dxDataGrid({
            dataSource: orders,
            columns: [
                'OrderID', 'CustomerID',
                { dataField: 'OrderDate', dataType: 'date' },
                { dataField: 'ShippedDate', dataType: 'date' },
                'ShipName',
                { dataField: 'ShipCountry', caption: 'Ship To' }
            ],
            paging: { pageSize: 7 },
            searchPanel: { visible: true }
        });
    
        $("#showSearchPanelCheckbox").dxCheckBox({
            text: 'Show Search Panel',
            value: true,
            onValueChanged: function (e) {
                $('#gridContainer').dxDataGrid('instance').option("searchPanel.visible", e.value);
            }
        });
    });
    

    width

    Specifies the width of the search panel in pixels.

    Type: Number
    Default Value: 160

    Show Example:
    AngularJS
    Knockout
    jQuery

    In this example, the width of the search panel is changed using the searchPanel | width option.

    <div ng-controller="demoController">
        <div style="height:390px; max-width:630px; margin: 0 auto" dx-data-grid="{
            dataSource: orders,
            columns: columns,
            paging: { pageSize: 7 },
            searchPanel: {
                visible: true,
                width: 250
            }
        }"></div>
    </div>
    
    var myApp = angular.module('myApp', ['dx']);
    myApp.controller("demoController", function ($scope) {
        $scope.orders = orders;
        $scope.columns = [
            'OrderID', 'CustomerID',
            { dataField: 'OrderDate', dataType: 'date' },
            { dataField: 'ShippedDate', dataType: 'date' },
            'ShipName',
            { dataField: 'ShipCountry', caption: 'Ship To' }
        ];
    });
    angular.element(document).ready(function () {
        angular.bootstrap(document, ['myApp']);
    });
    

    In this example, the width of the search panel is changed using the searchPanel | width option.

    <div style="height:390px; max-width:630px; margin: 0 auto" data-bind="dxDataGrid: {
        dataSource: orders,
        columns: columns,
        paging: { pageSize: 7 },
        searchPanel: {
            visible: true,
            width: 250
        }
    }"></div>
    
    var myViewModel = {
        orders: orders,
        columns: [
            'OrderID', 'CustomerID',
            { dataField: 'OrderDate', dataType: 'date' },
            { dataField: 'ShippedDate', dataType: 'date' },
            'ShipName',
            { dataField: 'ShipCountry', caption: 'Ship To' }
        ]
    }
    ko.applyBindings(myViewModel);
    

    In this example, the width of the search panel is changed using the searchPanel | width option.

    <div id="gridContainer" style="height:390px; max-width:630px; margin: 0 auto"></div>
    
    $(function () {
        $("#gridContainer").dxDataGrid({
            dataSource: orders,
            columns: [
                'OrderID', 'CustomerID',
                { dataField: 'OrderDate', dataType: 'date' },
                { dataField: 'ShippedDate', dataType: 'date' },
                'ShipName',
                { dataField: 'ShipCountry', caption: 'Ship To' }
            ],
            paging: { pageSize: 7 },
            searchPanel: {
                visible: true,
                width: 250
            }
        });
    });