Hi James,
1) How can I enable the filter just for specific cells?
Instead of removing the ColumnHeader cellmodel from the grid in the form's load, you can add the extra cell model called "ExcelColumnHeader" for filter column header of the grid. Here is a code snippet to show the ExcelColumnHeader for first column.
this.gridGroupingControl1.TableModel.CellModels.Add("ExcelColumnHeaderCell", new GridSortHeaderCellModel(this.gridGroupingControl1.TableModel));
this.gridGroupingControl1.TableDescriptor.Columns[1].Appearance.ColumnHeaderCell.CellType = "ExcelColumnHeaderCell";
2) How can I remove the 'Empty' and 'Custom' options from the drop down?
In the GridSortHeaderCellRenderer class, you can comment these line to remove the custom and empty options from the filter in the Grid_CellClick eventHandler. Here is a code snippet
private void Grid_CellClick(object sender, GridCellClickEventArgs e)
{
list.Hide();
if( filterRect.IntersectsWith(new Rectangle(e.MouseEventArgs.X,e.MouseEventArgs.Y,0,0)))
{
list.DataSource = null;
GridTableControl grid = this.Grid as GridTableControl;
list.Items.Clear();
DataTable dt = grid.Table.Engine.DataSource as DataTable;
CurrentColumnName = grid.TableDescriptor.Columns[ e.ColIndex - 1].MappingName;
list.Items.Add("All");
///////list.Items.Add("Custom");
///////list.Items.Add("Empty");
foreach( DataRow row in dt.Rows)
{
list.Items.Add(row[e.ColIndex -1]);
}
////your code here.
}
}
3)Can I replace the dialog the pops up when custom is selected with my own?
Yes. You can handle the List.Click event in GridSortHeaderCellRenderer and check the "Custom" to display your own pop.
else if ( row.ToString() == "Custom")
{
//You own pop here.
}
Please refer the sample for implementation.
ExcelStyleFilter_2003.zipBest Regards,
Haneef