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. Image for the cookie policy date

How to delete "Custom" from filter bar in ggc?

I know it was mentioned few times and probably here is an answer http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=323
But the link does not work.

Rafal

5 Replies

JJ Jisha Joy Syncfusion Team December 15, 2009 06:00 AM UTC

Hi Rafal,

You could use the following link for the KB:

http://www.syncfusion.com/support/kb/666/How-do-I-hide-the-

Please let me know if this helps.

Regards,
Jisha


RK Rafal Kasprzyk December 15, 2009 08:55 AM UTC

Is it really the only way to do it? There is no chance to get list of elements in filter combobox and delete one ex. "Custom" or "Empty"?

Rafal


JJ Jisha Joy Syncfusion Team December 15, 2009 10:10 AM UTC

Hi Raftal,


Here is the code to remove the custom option from the GridGroupingControl FilterBar by just handling two events.

void gridGroupingControl1_TableControlCurrentCellCloseDropDown(object sender, GridTableControlPopupClosedEventArgs e)
{
GridCurrentCell cc = e.TableControl.CurrentCell;
if (cc.Renderer is GridTableFilterBarCellRenderer)
{
GridTableFilterBarCellRenderer renderer = cc.Renderer as GridTableFilterBarCellRenderer;
renderer.ListBoxPart.Items.Add("");
if (renderer.ListBoxPart.SelectedIndex >=1 && renderer.ListBoxPart.SelectedIndex<=renderer.ListBoxPart.Items.Count - 1)
{
renderer.ListBoxPart.SelectedIndex += 1;
}
}
}

void gridGroupingControl1_TableControlCurrentCellShowingDropDown(object sender, GridTableControlCurrentCellShowingDropDownEventArgs e)
{
GridCurrentCell cc = e.TableControl.CurrentCell;
if (cc.Renderer is GridTableFilterBarCellRenderer)
{
GridTableFilterBarCellRenderer renderer = cc.Renderer as GridTableFilterBarCellRenderer;
GridTableCellStyleInfo tableStyleInfo = (GridTableCellStyleInfo)renderer.StyleInfo;
renderer.ListBoxPart.Items.RemoveAt(1);
}
}


Please let me know if this helps.

Regards,
Jisha


RK Rafal Kasprzyk December 15, 2009 10:13 AM UTC

Hello,

Thx, it works great.

Rafal


JJ Jisha Joy Syncfusion Team December 15, 2009 10:24 AM UTC

Hi Raftal,

Thank you for your update.

Regards,
Jisha

Loader.
Live Chat Icon For mobile
Up arrow icon