如何使用脚本显示 Kendo Grid 的 columnMenu [英] How to show Kendo Grid's columnMenu using script

查看:26
本文介绍了如何使用脚本显示 Kendo Grid 的 columnMenu的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Kendo Grid 有一个非常好的列上下文菜单(又名:columnMenu),您可以通过右键单击每个列标题来访问它.通过将 Kendo Grid 中的字段设置为:

The Kendo Grid has a really nice column context menu (aka: columnMenu) which you can access by right clicking on each column header. The menu is enabled by setting the field in the Kendo Grid to:

columnMenu: true

columnMenu: true

启用 columnMenu 后,它会在网格中显示列,并允许您显示/隐藏列、对其进行排序和过滤.但是,我们需要将此列菜单移出网格并将其绑定到按钮.所以当用户点击一个按钮时,列菜单就会出现.有没有办法通过javascript调用它?

When the columnMenu is enabled, it displays the columns in the grid and allows you to show/hide columns, sort, and filter on them. However, we have a requirement to move this column menu outside of the grid and tie it to a button. So when the user clicks on a button, the column menu will appear. Is there a way to invoke this via javascript?

此请求类似于 Michiel(2012 年 3 月 5 日)提出的请求.但是,在那个特殊情况下,它是对不同产品 Telerik MVC Grid 的 contextMenu 的请求.Michiel 问题的 URL 如下作为参考:http://www.telerik.com/community/forums/aspnet-mvc/grid/how-to-show-column-context-menu-using-script.aspx

This request is similar to one made by Michiel (March 5, 2012). However, in that particular case, it was a request for the contextMenu for a different product, the Telerik MVC Grid. The URL for Michiel's question is below as a reference: http://www.telerik.com/community/forums/aspnet-mvc/grid/how-to-show-column-context-menu-using-script.aspx

推荐答案

就跟触发列的点击事件一样简单:

It is as simple as triggering the click event of the column:

$("#grid .k-header-column-menu:first").click();

这是一个工作演示:http://jsbin.com/ihivif/2/edit

这篇关于如何使用脚本显示 Kendo Grid 的 columnMenu的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆