Customize grid column menu (replace it with filter sub-menu)

2 posts, 0 answers
  1. Martin Vesely
    Martin Vesely avatar
    11 posts
    Member since:
    May 2009

    Posted 13 Mar 2017 Link to this post

    Hi.

    I need to customize clasicall colum menu of grid. Insted of him i need to show his "Filter" - submenu.. But only on some columns. I solved this by cobe below:

                 function columnMenuInit(e, data) {
                     var self = this;
                     var field = e.field;
     
     
                     var gridId = "GridODU";
                     self.tr = this.thead.find("[data-field=" + e.field + "]");
     
     
                     if (field !== "Id" && field !== "id" && field !== "DruhPrijmu_Code" && field !== "ZuctovaciSymbol_Code") {
     
                         var menu = e.container.children().data("kendoMenu");
                         var filterMenuOptions = self.tr.data("kendoColumnMenu").filterMenu.options;
     
                         var menuParentWrapper = menu.wrapper;
                         menuParentWrapper.removeAttr('class');
                         menuParentWrapper.attr('class', 'k-reset');
                         menuParentWrapper.html("");
                         menuParentWrapper.append("<li class='customMenu'></li>");
     
                         if (filterMenuOptions.name == "FilterMultiCheck") {
                             menu.wrapper.find(".customMenu").kendoFilterMultiCheck(filterMenuOptions);;
                         } else {
                             menu.wrapper.find(".customMenu").kendoFilterMenu(filterMenuOptions);;
                         }
     
                     }
    }

     

    This solution works like I expected, but there is problem with doubled request to server for column fiter data. First request is made before columMenuInit event (thid fill with data filter submenu) and inicialization of kendoFilterMenu / kendoFilterMultiCheck in columMenuInit event cause second request.

    Is there some way how to do only one request ? Or is there any other solution how to achieve desired behaviour  ?

     

    Thanks!

  2. Angel Petrov
    Admin
    Angel Petrov avatar
    1141 posts

    Posted 14 Mar 2017 Link to this post

    Hello,

    Have you tried providing a customizing the filter menu as shown in this demo? Could you please share with us the entire grid configuration so we could examine the setup?

    Regards,
    Angel Petrov
    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.
Back to Top