Context Menu in Genie Tutorial
Introduction
In this tutorial, we show you how to create a context menu for a grid in Genie. In the following example, we demonstrate this on a grid that is located on the "Work with All Spooled Files" screen. As you can see in the video below, the first step is to choose a menu widget of your choice and drag it onto the screen. Once you have your menu, you should change the id of the context menu and set the visibility property to "hidden". With the visibility set to "hidden", the context menu will only show if you right-click on the grid. Next, you should set the "context menu id" of your grid to the id of the menu widget. Then, you will need to set the "choices" and "choices values" properties for your menu options and using JavaScript, you will need to write a custom function to process the menu options and place your custom function in the onoptionclick event for the menu. Finally, you will want to save and refresh your screen to see your changes. The following video gives you more detailed instructions on creating a context menu in Genie and walks you through an example of some custom JavaScript you might use in your onoptionclick event.
JavaScript function example:
function processMenuOption(value, substart, col) {
var subfile = getObj("subfile");
var sel = subfile.grid.getSelectedRows();
var count = 0;
for (var i = 0; i < sel.length; i++){
var field = "I_" + String(substart + sel[i] - 1) + "_" + col;
pui.set(field, value);
count++;
}
if (count > 0) pressKey("Enter");
}