jQuery-contextMenu
jQuery-contextMenu copied to clipboard
Is it possible to use jQuery ContextMenu to have 2 different menus one above the other inside a table?
I have a simple table like:
<table>
<tbody>
<tr role="row" class="context-menu-one">
<td>
<button class="context-menu-two">Left click</button>
</td>
</tr>
</tbody>
</table>
$(function() {
$.contextMenu({
selector: '.context-menu-one',
callback: function(key, options) {
var m = "clicked: " + key;
window.console && console.log(m) || alert(m);
},
items: {
"edit": {name: "Edit", icon: "edit"},
"cut": {name: "Cut", icon: "cut"},
copy: {name: "Copy", icon: "copy"},
"paste": {name: "Paste", icon: "paste"},
"delete": {name: "Delete", icon: "delete"},
"sep1": "---------",
"quit": {name: "Quit", icon: function(){
return 'context-menu-icon context-menu-icon-quit';
}}
}
});
$.contextMenu({
selector: '.context-menu-two',
trigger: 'left',
items: {
"new": {name: "New", icon: "new"},
"open": {name: "Open", icon: "open"}
}
});
});
I would like to open the first menu only on right click (on the table row) and open the second menu only on left click of the button (inside my row).
Is it possible? I've posted a question on SO here:
https://stackoverflow.com/questions/47445350/how-to-use-jquery-contextmenu-to-have-2-different-menus-one-above-the-other-insi
Yeah, i am aware of this bug, someone in our team (@JaZo) reported this one in their application. They ended up changing the selector to exclude the last TD which contains the button. But we should make a proper solution.