admin管理员组文章数量:1180511
I have a selectable KendoUI grid in my MVC app. I want to do something when the user double-clicks on the grid.
I don't see a double-click event for the grid.
How may I handle the double-click event when there is none exposed?
I have a selectable KendoUI grid in my MVC app. I want to do something when the user double-clicks on the grid.
I don't see a double-click event for the grid.
How may I handle the double-click event when there is none exposed?
Share Improve this question asked Dec 30, 2013 at 15:02 Water Cooler v2Water Cooler v2 33.8k63 gold badges181 silver badges362 bronze badges 04 Answers
Reset to default 18Use the standard double click event. The first click will select the grid row, adding a .k-state-selected
class to it, and the second click will trigger the double click event.
$("#yourgridname").on("dblclick", "tr.k-state-selected", function () {
// insert code here
});
You can also use dataBound
dataBound: function (e) {
var grid = this;
grid.tbody.find("tr").dblclick(function (e) {
var dataItem = grid.dataItem(this);
...
});
}
from http://www.telerik.com/forums/double-click-on-grid-row-with-angular
With kendoHelpers you can get the dataItem of the row. https://github.com/salarcode/kendoHelpers
kendoHelpers.grid.eventRowDoubleClick (theGrid,
function(dataItem){
// do stuff with dataItem
});
It also has eventCellDoubleClick
which works on cells.
Here's another way to handle it:
var grid = $('#myGrid').kendoGrid({
columnMenu: true,
filterable: true,
selectable: true,
// and many more configuration stuff...
}).data('kendoGrid');
grid.tbody.delegate('tr', 'dblclick', function() {
var dataItem = grid.dataItem($(this));
// do whatever you like with the row data...
});
Since v3.0, delegate
has been deprecated. You can use on
, like so:
grid.tbody.on('dblclick', 'tr', function() {
var dataItem = grid.dataItem($(this));
// do whatever you like with the row data...
});
本文标签: javascriptHow to handle a Kendo UI Grid row doubleclick eventStack Overflow
版权声明:本文标题:javascript - How to handle a Kendo UI Grid row double-click event - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738106859a2064392.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论