The currently active view controller (dialog, drawer, popover, embedded area, etc.), used to access view-level information and operations. Provided by FlowViewContext, it is only available within view content opened via ctx.viewer or ctx.openView.
| Scenario | Description |
|---|---|
| Dialog/Drawer Content | Use ctx.view.close() within the content to close the current view, or use Header and Footer to render titles and footers. |
| After Form Submission | Call ctx.view.close(result) after a successful submission to close the view and return the result. |
| JSBlock / Action | Determine the current view type via ctx.view.type, or read opening parameters from ctx.view.inputArgs. |
| Association Selection, Sub-tables | Read collectionName, filterByTk, parentId, etc., from inputArgs for data loading. |
Note:
ctx.viewis only available in RunJS environments with a view context (e.g., inside thecontentofctx.viewer.dialog(), in dialog forms, or inside association selectors). In standard pages or backend contexts, it isundefined. It is recommended to use optional chaining (ctx.view?.close?.()).
| Property/Method | Type | Description |
|---|---|---|
type | 'drawer' | 'popover' | 'dialog' | 'embed' | Current view type |
inputArgs | Record<string, any> | Parameters passed when opening the view (see below) |
Header | React.FC | null | Header component, used to render titles and action areas |
Footer | React.FC | null | Footer component, used to render buttons, etc. |
close(result?, force?) | void | Closes the current view; result can be passed back to the caller |
update(newConfig) | void | Updates view configuration (e.g., width, title) |
navigation | ViewNavigation | undefined | In-page view navigation, including Tab switching, etc. |
Currently, only
dialoganddrawersupportHeaderandFooter.
The fields in inputArgs vary depending on the opening scenario. Common fields include:
| Field | Description |
|---|---|
viewUid | View UID |
collectionName | Collection name |
filterByTk | Primary key filter (for single record details) |
parentId | Parent ID (for association scenarios) |
sourceId | Source record ID |
parentItem | Parent item data |
scene | Scene (e.g., create, edit, select) |
onChange | Callback after selection or change |
tabUid | Current Tab UID (within a page) |
Access these via ctx.getVar('ctx.view.inputArgs.xxx') or ctx.view.inputArgs.xxx.
| Purpose | Recommended Usage |
|---|---|
| Open a new view | ctx.viewer.dialog() / ctx.viewer.drawer() or ctx.openView() |
| Operate on current view | ctx.view.close(), ctx.view.update() |
| Get opening parameters | ctx.view.inputArgs |
ctx.viewer is responsible for "opening" a view, while ctx.view represents the "current" view instance. ctx.openView is used to open pre-configured workflow views.
ctx.view is only available inside a view; it is undefined on standard pages.ctx.view?.close?.() to avoid errors when no view context exists.result from close(result) is passed to the Promise returned by ctx.viewer.open().
ctx.viewerprovides methods likedialog(),drawer(),popover(), andembed()to open views. Thecontentopened by these methods can accessctx.view.