2013-01-11 208 views
0

右键点击这是我的网格:避免在剑道电网

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

当我CLIC行,我得到了行内文本,我把它放在另一个文本框。但我只想用左键鼠标来做到这一点,这样我就可以在网格中使用正确的clic来查看源代码页面。

回答

4

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

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

顺便说一句。 '.data()'里面的'KendoGrid'是什么意思? – anmarti

+0

这是为您提供小部件所有客户端功能的核心。一切都存储在该jQuery数据对象中。我建议您搜索文档以获取更多信息。这里是什么会给你的基本思路http://docs.kendoui.c​​om/getting-started/using-kendo-widgets#getting-the-widget-client-object –