Grid Columnchooser search in columns (contains / startswith)

We would like to have the ColumnChooser of the Grid to search for columns using a 'contains' instead of  the default 'startswith'. Is this possible?


1 Reply

PS Pavithra Subramaniyam Syncfusion Team December 2, 2022 07:41 AM UTC

Hi Sierd Weidema,


You can achieve your requirement by setting the “columnChooserSettings.operator” property as “contains”. Please refer to the below code example and the API link for more information.


@Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.parentData). Columns(col =>

{

    .  .  .

}).ShowColumnChooser(true).Toolbar(new List<string>(){ "ColumnChooser"}).Load("load"). Render()

 

 

<script>

    function load() {

        var grid = document.getElementById('Grid').ej2_instances[0];

        grid.columnChooserSettings = { operator: "contains" };

    }

</script>

 


https://ej2.syncfusion.com/documentation/api/grid/columnChooserSettings/#operator

https://ej2.syncfusion.com/documentation/api/grid#load


Please get back to us if you need further assistance on this.


Regards,

Pavithra S


Loader.
Up arrow icon