ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: pranit@srcomsec on January 18, 2023, 08:46:30 pm
-
I need to change the context menu name on the specific event.
I am trying with below code and it is not working. Please advise.
{
name: 'Pause Grid',
action: function () {
var lochkPauseID = this.element[0].id.replace("gridfilter", "chkPausetbl");
$("#" + lochkPauseID).prop("checked", !$("#" + lochkPauseID).is(':checked'));
if ($("#" + lochkPauseID).is(':checked'))
{
alert(("Grid Paused.");
this.name = "UnPause Grid"
}
else
{
alert("Grid UnPaused.");
this.name = "Pause Grid"
}
}
}
-
you can use callback variant to create dynamic context menu or a specific dynamic menu item.
In the callback you can check the condition: if ($("#" + lochkPauseID).is(':checked')) and name the menu item accordingly.
API:
https://paramquery.com/pro/api#option-contextMenu
-
I am trying to check for a sample code but not getting it.
Please share the sample code to change the existing context menu name.
-
Please advise on this.
-
This example: https://paramquery.com/pro/demos/context_menu shows 2 ways to change the menu item properties including the menu item names.
{
name: this.option('filterModel.header') ? 'Hide filter row' : 'Show filter row',
action: function(){
this.option('filterModel.header', !this.option('filterModel.header'));
this.refresh();
}
},
$("#change_img_menu").click(function () {
var items = grid.option('contextMenu').imgItems;
items[0].name = "custom name";
})