Chapter 13. Context Menus
Detail windows and task panes discussed above are shown in the SelectionChange event.
We can add such queries and much more to the context menu.
Let's add the following configuration to the EventHandlers table (two lines at the bottom):
Contrary to the SelectionChange handler, we have specified columns. So, context menus are shown for columns.
Also, we have directly specified select columns in the HANDLER_CODE. The plus sign defines the sort order.
@Company and @Item fields are used in the WHERE clause to filter output data using current row values.
Let's select the payments sheet, click Reload, Reload Data and Configuration, and right click on a company cell:
When we click on the dbo69.Payments item, the add-in shows the window like this:
You see rows for Rose, Inc. You can click on the status line to check the generated SQL:
Let's right click on any Revenue item cell and click on the dbo69.Payments item. We will see item payments.
As we learned above, the SelectionChange and ContextMenu handlers are nearly the same.
They get parameters from the columns of the active row. They differ by the EVENT_NAME configuration.
However, the ContextMenu handlers support additional configuration parameters like MENU_ORDER and EDIT_PARAMETERS and allow using much more handler types in the HANDLER_TYPE field.
You can configure executing stored procedures, SQL codes, macros, CMD commands, opening URLs.
Use the MenuSeparator type to separate menu items.