Hiding Filter Options

2 posts, 0 answers
  1. DogBizPro
    DogBizPro avatar
    158 posts
    Member since:
    Aug 2013

    Posted 11 Sep 2017 Link to this post

    I am trying to hide the filter options of a grid based on the type of the column. I have found numerous examples but NONE seem to work. They work the very first time you click on a filter icon. If you then click on a different type of column you get different options but not the correct ones. They seem to be random based on what order you click on the filter icon. Please help!!

            var oldFilterStyle = "";

            function FilterMenuShowing(sender, eventArgs) {

                var menu = eventArgs.get_menu();
                var items = menu._itemData;

                if (eventArgs.get_column().get_dataType() == "System.String") {
                    var i = 0;
                    while (i < items.length) {
                        if (items[i].value != "NoFilter" && items[i].value != "IsEmpty" &&
                            items[i].value != "EqualTo" && items[i].value != "NotEqualTo" && 
                            items[i].value != "StartsWith" && items[i].value != "EndsWith" && 
                            items[i].value != "Contains" && items[i].value != "DoesNotContain") {
                            var item = menu._findItemByValue(items[i].value);
                            if (item != null) {
                                if (item._element.style.display != "none") {
                                    oldFilterStyle = item._element.style.display;
                                    item._element.style.display = "none";
                                }                           
                            }
                        }
                        i++;
                    }
                }
                else if (eventArgs.get_column().get_dataType() == "System.Decimal" || eventArgs.get_column().get_dataType() == "System.Int32") {
                    var i = 0;
                    while (i < items.length) {
                        if (items[i].value != "NoFilter" && items[i].value != "IsEmpty" &&
                            items[i].value != "EqualTo" && items[i].value != "NotEqualTo" && 
                            items[i].value != "GreaterThan" && items[i].value != "LessThan" && 
                            items[i].value != "GreaterThanOrEqualTo" && items[i].value != "LessThanOrEqualTo" && 
                            items[i].value != "Between" && items[i].value != "NotBetween") {
                            var item = menu._findItemByValue(items[i].value);
                            if (item != null) {
                                if (item._element.style.display != "none") {
                                    oldFilterStyle = item._element.style.display;
                                    item._element.style.display = "none";
                                }
                            }
                        }
                        i++;
                    }
                }
                else {
                    alert(eventArgs.get_column().get_dataType());
                    var i = 0;
                    while (i < items.length) {
                        var item = menu._findItemByValue(items[i].value);
                        if (item != null) {
                            if (oldFilterStyle != "" && item._element.style.display == "none")
                                item._element.style.display = oldFilterStyle;
                        }
                        i++;
                    }
                }

  2. Attila Antal
    Admin
    Attila Antal avatar
    384 posts

    Posted 15 Sep 2017 Link to this post

    Hello Stephanie,

    I believe we are already discussing this matter on your official support ticket. For others, I had already copied the reply here:
    http://www.telerik.com/forums/reducing-filter-options-in-radgrid#os5910X_g0WZTdbMpFTd6w

    For any other remaining issues, I suggest that we stick to the formal support ticket. This will allow us to answer you faster and more efficiently. Please bear in mind that opening multiple threads for the same issue is not recommended. 

    Regards,
    Attila
    Progress Telerik
    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.
Back to Top