This is a migrated thread and some comments may be shown as answers.

Limiting filter predicates

3 Answers 72 Views
GridView
This is a migrated thread and some comments may be shown as answers.
IT Department
Top achievements
Rank 1
IT Department asked on 23 Jun 2010, 09:29 PM
Is there a way to limit or hide the default filter predicates that are displayed? I have no use for Is Null, Is Not Null, or the custom option.

3 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 29 Jun 2010, 12:58 PM
Hello Grant Fish,

Please find the answer to this question in your support ticket concerning the same topic (Ticket ID 321931). If you have any other questions, we will be glad to help.

Best wishes,
Jack
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Anisha
Top achievements
Rank 1
answered on 31 Aug 2010, 02:10 PM
Is it possible to post this answer in the forum? I would also like to know how to limit filter predicates.

Thanks
Anisha 
0
Jack
Telerik team
answered on 02 Sep 2010, 05:37 PM
Hi Anisha,

Yes, here is the answer:

You can customize the available filter actions by handling the ContextMenuOpening event. When handling this event, you have full control over the context menu and can hide or disable any item. Consider the sample below:

void radGridView1_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
{
    if (e.ContextMenuProvider == null)
    {
        string isNullName = RadGridLocalizationProvider.CurrentProvider.GetLocalizedString(RadGridStringId.FilterFunctionIsNull);
        RadMenuItem item = FindMenuItem(e.ContextMenu, isNullName);
        if (item != null)
        {
            item.Enabled = false;
        }
    }
}
  
private RadMenuItem FindMenuItem(RadDropDownMenu menu, string itemName)
{
    foreach (RadMenuItem item in menu.Items)
    {
        if (item.Text == itemName)
        {
            return item;
        }
    }
    return null;
}

You have a point, we have to implement a more convenient API that allows for customizing the available filter predicates. We will also update our documentation. Please share your opinion on how such an API should look like and should behave. We will consider your feedback when planning our future releases.


Sincerely yours,
Jack
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
IT Department
Top achievements
Rank 1
Answers by
Jack
Telerik team
Anisha
Top achievements
Rank 1
Share this question
or