【问题标题】:Avoid right click on kendo grid避免右键单击剑道网格
【发布时间】:2013-01-11 13:34:27
【问题描述】:

这是我的网格:

$("#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"
    }
    ]
});

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

【问题讨论】:

    标签: jquery telerik kendo-ui


    【解决方案1】:

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

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

    【讨论】:

    • 顺便说一句。 KendoGrid 里面 .data() 是什么意思?
    • 这是为您提供小部件所有客户端功能的核心。一切都存储在那个 jQuery 数据对象中。我建议您搜索文档以获取更多信息。这是什么会给你基本的想法docs.kendoui.com/getting-started/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-12
    • 1970-01-01
    • 2016-07-25
    • 2014-06-20
    相关资源
    最近更新 更多