We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to enable ExcelStyleFIlter only for specific columns

Thread ID:

Created:

Updated:

Platform:

Replies:

52728 Dec 3,2006 06:27 AM UTC Dec 5,2006 06:20 AM UTC WinForms 1
loading
Tags: Grouping
James Blibo
Asked On December 3, 2006 06:27 AM UTC

In your ExcelStyleFilter, the filter is enable for every column header cell.

How can I enable the filter just for specific cells?

How can I remove the 'Empty' and 'Custom' options from the drop down?

Can I replace the dialog the pops up when custom is selected with my own?

Administrator [Syncfusion]
Replied On December 5, 2006 06:20 AM UTC

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.zip

Best Regards,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;