问题描述
我试图获得Kendo Grid的点击事件,这样我就可以将东西绑定到shift和ctrl点击。我无法使用Kendo提供的固有多选,因为它不支持拖放操作。当我在dataBound事件后创建一个函数时,我的函数被点击时调用,但它不是典型的点击事件。
在初始化 Grid
$ $ $ $ (click,table,function(e){
console.log(clicked,e.ctrlKey,e.altKey,e.shiftKey);
} );
您可以使用:
- e.ctrlKey 用于检测是否按下。
- e.altKey 用于检测是否按下。
- e.shiftKey 用于检测是否按下。
如果您只想检测点击您可以用tbody甚至td替换table 。
。
I'm trying to get the click event for a Kendo Grid so I can bind stuff to shift and ctrl clicking. I can't use the inherent multiselect Kendo provides because it doesn't support drag and drop. When I create a function after the dataBound event, my function gets called on clicking, but it's not the typical click event.
var onDataBound = function () { selectItem.apply(this); } grid.dataBound = onDataBound; var selectItem.apply = function (e) { console.log(e); }
Any thoughts? Thanks in advance.
解决方案After initializing the Grid you should bind a handler to the click event.
Example:
$("#grid").on("click", "table", function(e) { console.log("clicked", e.ctrlKey, e.altKey, e.shiftKey); });
You can use:
- e.ctrlKey for detecting if is pressed.
- e.altKey for detecting if is pressed.
- e.shiftKey for detecting if is pressed.
If you want to detect click only in the body of the table, you can replace "table" by "tbody" or even "td".
这篇关于在剑道网格中获取点击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!