Hy,
In my application I am using JQGrid tool for displaying the lists.
I need to show context menu on both left and right click (my client choice…). Is this possible?
For displaying the context menu on right click I am using the loadComplete function like this:
loadComplete: function () {
$("tr.jqgrow", this).contextMenu('contextMenu', {
bindings: {...},
onContextMenu: function (event) {...}
});
},
and it’s working fine.
For displaying the context menu on left click I’ve tried the beforeSelectRow function:
beforeSelectRow: function (rowid, e){
$("tr.jqgrow", this).contextMenu('contextMenu', {
bindings: {...},
onContextMenu: function (event) {...}
});
},
but it’s not working!
Does anyone have any idea how can I show the context menu at left-click on the row (or maybe selecting the row, it’s the same)?
Thanks in advance,
Jeff
I suggest that you just bind
clickevent to the same event handler defined in thejquery.contextmenu.js. To do this you can use the following codeI use the fixed version of
jquery.contextmenu.jswhich now a part of jqGrid (see my suggestions here). So I boundcontextMenunot to every grid row, but to the grid element directly.The demo shows that the above approach works. If you use additional bindings to
contextmenuevent you can improve the code above to choose the correct event handlercmenu[i].handler.