Limit filter options header context menu

6 posts, 0 answers
  1. Jonathan
    Jonathan avatar
    3 posts
    Member since:
    Nov 2016

    Posted 14 Nov 2016 Link to this post

    How would I go about limiting filter options in the header context menu?

    Any help would be greatly appreciated

    Thanks

  2. Rumen
    Admin
    Rumen avatar
    13902 posts

    Posted 15 Nov 2016 Link to this post

    Hi Jonathan,

    There is a help article which provides guidance on how to Reduce the Filter Menu Options.

    Best regards,
    Rumen
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Jonathan
    Jonathan avatar
    3 posts
    Member since:
    Nov 2016

    Posted 15 Nov 2016 in reply to Rumen Link to this post

    Hi, thanks for replying, I probably should have been a little more specific. I'm talking about the filter menu for when the EnableHeaderContextMenu and EnableHeaderContextFilterMenu are set to true in the radgrid. I have tried the solution in the article you linked and it does not work for when those two properties are set to true in the radgrid
  4. Rumen
    Admin
    Rumen avatar
    13902 posts

    Posted 17 Nov 2016 Link to this post

    Hi Jonathan,

    Thank you for the additional information.

    You can use the OnHeaderMenuShowing client event to hide the desired context menu item(s). You can also see this forum: http://www.telerik.com/forums/hide-columns-in-header-context-menu-for-column

    Please, note that the items from the menu will be displayed dynamically depending on the grid configuration. For example, if the grouping feature is disabled the 'Group By'/'Ungroup' options will be hidden, or if you choose not to use natural sorting (AllowNaturalSort=false) the 'Clear Sorting' item will be absent.

    Best regards,
    Rumen
    Telerik by Progress
    Telerik UI for ASP.NET AJAX is ready for Visual Studio 2017 RC! Learn more.
  5. Jonathan
    Jonathan avatar
    3 posts
    Member since:
    Nov 2016

    Posted 17 Nov 2016 in reply to Rumen Link to this post

    Thank you for the helpful information Rumen. Everything works great but I run into one problem. When the grid is in mobile render mode none of these events seem to fire. Is there something else I need to do differently when the grid is in mobile render mode?
  6. Rumen
    Admin
    Rumen avatar
    13902 posts

    Posted 18 Nov 2016 Link to this post

    For the mobile grid, you can try the following 3 step approach:

    <style>
            .hiddenFilterFunction {
                display: none !important;
            }
    </style>


    Grid Client Settings:
    <ClientSettings>
          <ClientEvents OnGridCreated="gridCreated" />
    </ClientSettings>

    Client-side function
    <script>
                function gridCreated(sender, args) {
                    var filterFunctionsToHide = ["Between", "LessThan", "LessThanOrEqualTo", "GreaterThan", "GreaterThanOrEqualTo"];
                    for (var i = 0; i < filterFunctionsToHide.length; i++) {
                        $(".rgMobileFilterForm").find("select.rgValue")
                            .find("option[value='" + filterFunctionsToHide[i] + "']")
                            .each(function () { this.className = "hiddenFilterFunction"; });;
                    }
                }
    </script>


    Regards,
    Rumen
    Telerik by Progress
    Telerik UI for ASP.NET AJAX is ready for Visual Studio 2017 RC! Learn more.
Back to Top