避免右键单击剑道网格 [英] Avoid right click on kendo grid

查看:86
本文介绍了避免右键单击剑道网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的网格:

$("#myHtmlTable1").kendoGrid({
    dataSource: {
        pageSize: 18
    },
    scrollable: false,
    sortable: true,
    filterable: true,
    selectable: true,
    pageable: {
        input: false,
        numeric: false
    },
    change: function () {
        // MY LOGIC
    },
    columns: [
    {
        field: "Col1",
        width: 40
    },
    {
        field: "Col2",
        width: 250
    },
    {
        width: 40,
        field: "Col3"
    },
    {
        width: 150,
        field: "Col4"
    }
    ]
});

当我单击一行时,我得到行文本,然后将其放在另一个文本框中.但是我只想使用鼠标左键来执行此操作,这样我就可以在网格上方使用右键来查看源代码页.

When I clic a row I get the row text and I put it in another textbox. But I want to do this only with left button mouse so that I can see the source code page using the right clic over the grid.

推荐答案

可以在触发文档事件时将以下keydown处理程序附加到Grid的tbody元素上,以防止右键单击mousedown事件冒泡,从而避免网格对此做出反应.

You can attach the following keydown handler to the tbody element of the Grid when the document event is triggered to prevent the right click mousedown event from bubling and thus avoid the Grid reacting to it.

$(function(){
    $('#myHtmlTable1').data('kendoGrid').tbody.on('mousedown',function(e){
        if(e.button==2){
            e.stopImmediatePropagation()
        }
    })
})

这篇关于避免右键单击剑道网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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