Remove Custom filter option from Filler Menu

9 posts, 2 answers
  1. Piotr
    Piotr avatar
    3 posts
    Member since:
    Dec 2017

    Posted 21 Dec 2017 Link to this post

    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

  2. Answer
    Dimitar
    Admin
    Dimitar avatar
    2841 posts

    Posted 21 Dec 2017 Link to this post

    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.
  3. Piotr
    Piotr avatar
    3 posts
    Member since:
    Dec 2017

    Posted 21 Dec 2017 in reply to Dimitar Link to this post

    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.

     

  4. Piotr
    Piotr avatar
    3 posts
    Member since:
    Dec 2017

    Posted 21 Dec 2017 in reply to Dimitar Link to this post

    It works!

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

  5. Answer
    Dimitar
    Admin
    Dimitar avatar
    2841 posts

    Posted 21 Dec 2017 Link to this post

    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.
  6. Tom
    Tom avatar
    8 posts
    Member since:
    Dec 2010

    Posted 27 Aug 2018 in reply to Dimitar Link to this post

    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

  7. Dimitar
    Admin
    Dimitar avatar
    2841 posts

    Posted 28 Aug 2018 Link to this post

    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.
  8. Tom
    Tom avatar
    8 posts
    Member since:
    Dec 2010

    Posted 28 Aug 2018 in reply to Dimitar Link to this post

    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

     

  9. Dimitar
    Admin
    Dimitar avatar
    2841 posts

    Posted 29 Aug 2018 Link to this post

    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.
Back to Top