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

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

1 Answer 418 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jana Vichtova
Top achievements
Rank 1
Jana Vichtova asked on 13 Mar 2017, 06:33 AM

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!

1 Answer, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 14 Mar 2017, 11:58 AM
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.
Tags
Grid
Asked by
Jana Vichtova
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Share this question
or