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

Limit filter options header context menu

5 Answers 268 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 15 Nov 2016, 03:16 AM

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

Any help would be greatly appreciated

Thanks

5 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 15 Nov 2016, 02:46 PM
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.
0
Jonathan
Top achievements
Rank 1
answered on 15 Nov 2016, 04:37 PM
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
0
Rumen
Telerik team
answered on 17 Nov 2016, 12:00 PM
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.
0
Jonathan
Top achievements
Rank 1
answered on 17 Nov 2016, 05:02 PM
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?
0
Rumen
Telerik team
answered on 18 Nov 2016, 03:15 PM
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.
Tags
Grid
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Jonathan
Top achievements
Rank 1
Share this question
or