How can I implement a righ-click context-menu in JqGrid for PHP ?
I am trying this solution by Oleg, but it is not working. I would like to get this:
grid.php snippet:
$rightclick = <<<RIGHTCLICK
function () {
$("tr.jqgrow", this).contextMenu('myMenu1', {
bindings: {
'edit': function (trigger) {
// trigger is the DOM element ("tr.jqgrow") which are triggered
grid.editGridRow(trigger.id, editSettings);
},
'add': function ( /*trigger*/ ) {
grid.editGridRow("new", addSettings);
},
'del': function (trigger) {
if ($('#del').hasClass('ui-state-disabled') === false) {
// disabled item can do be choosed
grid.delGridRow(trigger.id, delSettings);
}
}
},
onContextMenu: function (event /*, menu*/ ) {
var rowId = $(event.target).closest("tr.jqgrow").attr("id");
//grid.setSelection(rowId);
// disable menu for rows with even rowids
$('#del').attr("disabled", Number(rowId) % 2 === 0);
if (Number(rowId) % 2 === 0) {
$('#del').attr("disabled", "disabled").addClass('ui-state-disabled');
} else {
$('#del').removeAttr("disabled").removeClass('ui-state-disabled');
}
return true;
}
});
}
RIGHTCLICK;
$grid->setGridEvent('loadComplete ', $rightclick);
Is there any way to get a context menu in JqGrid for PHP ?