简体   繁体   English

剑道网格行双击事件不起作用

[英]kendo grid row double click event not working

kendo grid row double click event not working 剑道网格行双击事件不起作用

Hi , I am working on a web application with kendo grid and i've bind doubleclick event to the grid.But when the user click in a particular cell the double click event not firing.I think those cells having inner templates like "div"(click event works fine.The issue is only in double click).Any help? 嗨,我正在使用kendo网格处理Web应用程序,并将doubleclick事件绑定到了网格。但是,当用户单击特定单元格时,双击事件没有触发。我认为这些单元格具有内部模板,例如“ div” (单击事件效果很好。问题仅在双击时有效)。有帮助吗?

You can try: 你可以试试:

$("#grid").on("dblclick", "tr.k-state-selected", function () {
    alert("Double click");
});

Its better to have the dbl click event on the tr row element. 最好在tr row元素上具有dbl click事件。 That way you can access your dataItem object in the kendo grid if needed. 这样,如果需要,您可以在kendo网格中访问dataItem对象。 In your kendogrid databound event, add this code: 在您的kendogrid数据绑定事件中,添加以下代码:

if ($("#your-grid").find("tbody").children().length <= 0) {
        $.each($("#your-grid").find("tbody").find("tr"), function () {
                $(this).addClass("row-dbl-click");
        });
    }

Now you need to handle the dbl click event: 现在,您需要处理dbl click事件:

$(document).on("dblclick", ".row-dbl-click", function (e) { //do stuff });

I havent tested it but it should work. 我还没有测试过,但应该可以。 Good luck. 祝好运。

Below code is working for Double click event : 以下代码适用于DoubleClick事件:

$('#grid table tr').live('dblclick', function () {

alert(' grid dbl clicked'); alert('Grid dbl click'); }); });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM