Filtering and Multicolumn Sorting in Syncfusion’s Grid Control

Last week I was working with a C# application that used Syncfusion's standard grid control and I was trying to add filtering and multicolumn sorting to the grid. However, as it turns out, the grid does not support filtering or multicolumn sorting out of the box.

Instead, Syncfusion offers another control, called the GridGroupingControl that have these features. Unfortunately, this was very inconvenient for me as the application I worked on is well established and replacing the standard GridControl with the GridGroupingControl would require a tremendous amount of effort. I've been in touch with the folks at Syncfusion and finally reached the following workarounds.


1. Filtering
The filter operation can be simulated by adding combo box cells in each column you wish to filter by. The CurrentCellShowingDrowDown event can be used to populate the filter values into the combo box cells. Once the user selects the filter option, the QueryRowHeight event can be used to only show the rows that match the filter.

Here's how it would look. You can download this example here.

GridControlFilter

2. Multicolumn Sorting
Multicolumn sorting in the GridControl can be achieved through a custom comparer. Using the CellClick event you can determine whether the user has clicked a header cell and then the SortByColumn method is used to perform the sort.

Here is how this would look. You can also download an example of this here.

GridControlMutiSorting

Hope this helps.

One thought on “Filtering and Multicolumn Sorting in Syncfusion’s Grid Control”

Leave a Reply

Your email address will not be published. Required fields are marked *