To achieve this, implement a custom filter bar cell that derives the cell model/cell renderer from the GridTableFilterBarCellModel/GridTableFilterBarCellRenderer. The GridTableFilterBarCellModel.FillWithChoices method is overridden to remove the string Custom from the list. C# VB The GridTableFilterBarCellModel.Select method is rewritten with the Select_withoutcustom method that specifies the index for the selected item. You can pass the index for the Custom selected item as 0. C# VB The GridTableFilterBarCellModel.ListBoxMouseUp() method is overridden to invoke the Select_withoutcustom method instead of the Select method. C# VB A new CellType is created by adding the instance of the derived GridTableFilterBarCellModel class into the GridGroupingControl’s cellmodels. C# VB After applying the properties, the Grid is displayed as follows. Figure 1: Hiding the custom option Sample Links
|
Article ID: | Published Date: | Last Revised Date: | Platform: | Control: |
666 | 04/30/2011 | 02/12/2016 | WinForms | GridGroupingControl |
maurizio ziraldo | Jun 11, 2015 |
This solution has a problem when you have some hidden columns. Add this line of code to your sample in Form1.cs: this.gridGroupingControl1.TableDescriptor.VisibleColumns.Remove("Name"); then run the sample and try to filter by WorkingBranch: you will see that the filter is applied to the wrong column City. To avoid this you can change this line: string _columnName = _grid.TableDescriptor.Columns[_filed].Name; with string _columnName = _grid.TableDescriptor.VisibleColumns[_filed].Name; in ListBoxMouseUp event of custom Cell Model. | |
Venkatesh Sundaram [Syncfusion] | Jun 12, 2015 |
Hi Maurizio , Thanks for your valuable suggestions. We have modified the sample as per your suggestions and the sample link is updated in the kb article. please let us know if you have any concerns. Thanks and Regards, Venkat. | |
or the page will be automatically redirected to sign-in page in 10 seconds.