You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is important to note that a menu can only have an action or submenus. It cannot have both. A parent menu is not a clickable menu, it can only contain submenus that are clickable or more parent menus. If you try to add both submenus and an action to a menu, the code will not compile.
24
+
A menu can only have an action or sub-menus—it cannot have both. A parent menu is not a clickable menu, it can only contain sub-menus that are clickable or more parent menus. If you try to add both sub-menus and an action to a menu, the code will not compile.
25
25
{{% /alert %}}
26
26
27
-
# Menu action payload
28
-
The menu can have a context or no context. When adding a context menu to a document or an entity through our [appExplorer](/apidocs-mxsdk/apidocs/web-extensibility-api-11/app-explorer-api/) or [documents](/apidocs-mxsdk/apidocs/web-extensibility-api-11/documents-api/) APIs, Studio Pro will send the document id back to the menu, which then will invoke the action passing this document id as the argument. Which means the menu will need to be a `Menu<DocumentContext>`. So when you create the menu with this context, the action needs to have a `DocumentContext` as its argument, or the action will not receive the document id when the context menu gets clicked.
29
-
**The code will not compile if your action has the wrong payload** (e.g. if you pass a number or a different object), but it is perfectly fine for your action to have no payload at all, since your context menu might not need to do anything with the ID of the document.
27
+
## Menu Action Payload
28
+
29
+
A menu can either have a context or no context. When adding a context menu to a document or an entity through the [appExplorer](/apidocs-mxsdk/apidocs/web-extensibility-api-11/app-explorer-api/) or [documents](/apidocs-mxsdk/apidocs/web-extensibility-api-11/documents-api/) APIs, Studio Pro sends the document Id back to the menu. The menu then invokes the action and passes this document Id as the argument. Because of this, the menu must be identified as `Menu<DocumentContext>`. When you create the menu with this context, the action needs to have a `DocumentContext` argument; otherwise, the action will not receive the document Id when the context menu is clicked.
30
+
31
+
{{% alert="info" %}}
32
+
The code will not compile if your action has the wrong payload (for example, if you pass a number or a different object). However, it is valid for your action to have no payload at all if your context menu does not need to use the document Id.
33
+
{{% /alert %}}
30
34
31
35
The `DocumentContext` type has only one property, the `documentId` string:
0 commit comments