Layouts give app providers the ability to embed multiple views in a single window. The Layout namespace enables the initialization and manipulation of a window's Layout. A Layout will emit events locally on the DOM element representing the layout-container.
Methods
(async, static) getCurrent() → {Promise.<Layout>}
Asynchronously returns a Layout object that represents a Window's layout.
- Tutorials:
Returns:
- Type
- Promise.<Layout>
(static) getCurrentSync() → {Layout}
Synchronously returns a Layout object that represents a Window's layout.
- Tutorials:
Returns:
- Type
- Layout
(async, static) wrap(identity) → {Promise.<Layout>}
Asynchronously returns a Layout object that represents a Window's layout.
Parameters:
Name | Type | Description |
---|---|---|
identity |
Identity |
- Tutorials:
Returns:
- Type
- Promise.<Layout>
(static) wrapSync(identity) → {Layout}
Synchronously returns a Layout object that represents a Window's layout.
Parameters:
Name | Type | Description |
---|---|---|
identity |
Identity |
- Tutorials:
Returns:
- Type
- Layout
applyPreset(options) → {Promise.<void>}
Replaces a Platform window's layout with a preset layout arrangement using the existing Views attached to the window.
The preset options are columns
, grid
, rows
, and tabs
.
Parameters:
Name | Type | Description |
---|---|---|
options |
PresetLayoutOptions | Mandatory object with |
- Tutorials:
Returns:
- Type
- Promise.<void>
(async) getConfig() → {Promise.<LayoutConfig>}
Returns the configuration of the window's layout. Returns the same information that is returned for all windows in getSnapshot.
- Tutorials:
Returns:
- Type
- Promise.<LayoutConfig>
(async) getRootItem() → {Promise.<(TabStack|ColumnOrRow)>}
Retrieves the top level content item of the layout.
Returns:
- Type
- Promise.<(TabStack|ColumnOrRow)>
init(optionsopt) → {Promise.<Layout>}
Initialize the window's Layout. Must be called from a custom window that has a 'layout' option set upon creation of that window.
If a containerId is not provided, this method attempts to find an element with the id layout-container
.
A Layout will emit events locally on the DOM element representing the layout-container.
In order to capture the relevant events during Layout initiation, set up the listeners on the DOM element prior to calling init
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
InitLayoutOptions |
<optional> |
Layout init options. |
- Tutorials:
Returns:
- Type
- Promise.<Layout>
replace(layout) → {Promise.<void>}
Replaces a Platform window's layout with a new layout. Any views that were in the old layout but not the new layout will be destroyed.
Parameters:
Name | Type | Description |
---|---|---|
layout |
LayoutConfig | New layout to implement in the target window. Please see explanation of a layout here. |
- Tutorials:
Returns:
- Type
- Promise.<void>
replaceView(viewToReplace, newView) → {Promise.<void>}
Replaces the specified view with a view with the provided configuration.
The old view is stripped of its listeners and either closed or attached to the provider window
depending on detachOnClose
view option.
Parameters:
Name | Type | Description |
---|---|---|
viewToReplace |
Identity | Identity of the view to be replaced |
newView |
View~options | Creation options of the new view. |
- Tutorials:
Returns:
- Type
- Promise.<void>