How to handle a Kendo UI Grid row double-click eve

2019-02-09 08:44发布

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?

3条回答
Viruses.
2楼-- · 2019-02-09 08:58

Use 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
});
查看更多
冷血范
3楼-- · 2019-02-09 09:09

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

查看更多
Summer. ? 凉城
4楼-- · 2019-02-09 09:16

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.

查看更多
登录 后发表回答