问题
This is my grid:
$("#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.
回答1:
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()
}
})
})
来源:https://stackoverflow.com/questions/14279285/avoid-right-click-on-kendo-grid