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

Remove Custom filter option from Filler Menu

8 Answers 177 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Piotr
Top achievements
Rank 1
Piotr asked on 21 Dec 2017, 09:08 AM

Hello,

Im new into Telerik UI and I have a simple question:

How to remove a "Custom" filter option/element from filters menu on the top of all radGridView columns. 

 

Thanks in advance

Piotr

8 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 21 Dec 2017, 09:19 AM
Hello Piotr,

You can use the ContextMenuOpenning event for this:
private void RadGridView1_ContextMenuOpening(object sender, Telerik.WinControls.UI.ContextMenuOpeningEventArgs e)
{
    if (e.ContextMenuProvider is GridFilterCellElement)
    {
        e.ContextMenu.Items.RemoveAt(e.ContextMenu.Items.Count - 1);
    }
}

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Piotr
Top achievements
Rank 1
answered on 21 Dec 2017, 09:43 AM

Hello Dimitar, thank You for quick response but unfortunatelly it didnt help.

Maybe its because i localized this menu before? But I just want to disable "Custom" filter option from Filtering menu, so it should be an simple "inbox" function. I send a screen below.

 

0
Piotr
Top achievements
Rank 1
answered on 21 Dec 2017, 10:28 AM

It works!

Very sorry for my misleading and thanks for yor help :)

0
Accepted
Dimitar
Telerik team
answered on 21 Dec 2017, 10:53 AM
Hi Piotr,

You can use the text to remove the item as well:
private void RadGridView1_ContextMenuOpening(object sender, Telerik.WinControls.UI.ContextMenuOpeningEventArgs e)
{
    if (e.ContextMenuProvider is GridFilterCellElement)
    {
        foreach (var item in e.ContextMenu.Items)
        {
            if (item.Text == "Custom")
            {
                e.ContextMenu.Items.Remove(item);
                break;
            }
        }
        
    }
}

Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Tom
Top achievements
Rank 1
answered on 27 Aug 2018, 01:28 PM

Hi Dimitar!
I've got the same problem, 'cause the 'Custom' option throws an exception.

And additionally I've got a lot of RadGridViews in my solution and I don't want to add this code to all of them.
Is there another solution, which I can implement just one time for the complete solution? 

E.g. is it possible to replace the default filter menu with that one w/o the 'Custom' option and assign it to all radgridviews?

 

Regards

Tom

0
Dimitar
Telerik team
answered on 28 Aug 2018, 09:08 AM
Hello Tom,

The context menu is built dynamically at runtime depending on the data type of the field. Because of this, you cannot assign this context menu. I am afraid that in this case there is no simpler solution that can be used for this. 

I am not sure why the custom option causes an exception. What I can recommend is posting a ticket and attaching a project that reproduces it. This will allow us to properly investigate the case.  

Regards,
Dimitar
Progress Telerik
Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Tom
Top achievements
Rank 1
answered on 28 Aug 2018, 11:56 AM

Hello Dimitar,

I see, in this case a property like 'radGridView1.ShowCustomOptionInStandardFilterMenu=false;' would be helpful, which allows to control this behavior in a one-line-statement unlike the required '_ContextMenuOpening()' - event handler + special treatment for each radgridview.

I don't know, why the option causes an exception, but in fact most users don't really need it. But there are some of them who like to play around with all possible options and report the errors in case of exceptions. I've tried to investigate the error condition but it seems to be out of reach for me even in debug mode. So due to lack of time I decided to deactivate it.

 

Regards

Tom

 

0
Dimitar
Telerik team
answered on 29 Aug 2018, 07:38 AM
Hello Tom,

Ok, we will consider this and we will add such property if we receive more requests for it.

Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Progress Telerik
Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Piotr
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Piotr
Top achievements
Rank 1
Tom
Top achievements
Rank 1
Share this question
or