LayoutApi
Table and Pivot Layouts: the layout that is selected, its columns, sorts and row groups, and creating, cloning, editing and deleting layouts.
export interfaceMethods
| Method | Returns | Description |
|---|---|---|
| addColumnToCurrentLayout(columnId) | void | Adds a Column to Current Table or Pivot Layout |
| addObjectToLayout(object, module, layoutName) | void | Extends an object into a Layout - once extended into any Layout, it applies only in those Layouts |
| cloneAndSetLayout(layoutToClone, layoutName) | Layout | false | Creates new Layout by cloning a given Layout and then loads it into Grid |
| cloneExtendedLayout(extendedLayoutToClone, layoutName) | ExtendedLayout | false | Clones an Extended Layout - the new Layout is extended with the same objects |
| cloneLayout(layoutToClone, layoutName) | Layout | false | Creates new Layout by cloning a given Layout |
| createAndSetLayout(layoutToCreate) | Layout | false | Creates new Layout and loads it into Grid |
| createLayout(layoutToCreate) | Layout | false | Creates a new Layout |
| createOrUpdateExtendedLayout(extendedLayout) | void | Creates (or Updates) an Extended Layout: saves the Layout, adds any extension objects not yet in state, and makes those objects the Layout's complete Layout Extension |
| createOrUpdateLayout(layout) | void | Creates new Layout into Adaptable State or updates an existing Layout (with same name or id) |
| deleteLayout(layout) | void | Deletes an existing Layout (if not Default or only existing Layout) |
| deleteLayoutByName(layoutName) | void | Deletes a Layout by name. Does nothing when it is the only Layout. |
| doesLayoutExist(layout) | boolean | Whether this Layout is already in Layout State. Compared by Uuid. |
| getCurrentLayout() | Layout | Retrieves Current Layout from Layout State |
| getCurrentLayoutColumnSort(columnId) | ColumnSort['SortOrder'] | null | The sort direction of a column in the current Layout. |
| getCurrentLayoutName() | string | Name of the Layout that is selected. |
| getCurrentRowGroupsColumnIds() | string[] | Columns that group rows in the current Layout. |
| getCurrentVisibleColumnIdsForPivotLayout() | string[] | Column ids currently displayed in a Pivot Layout. |
| getCurrentVisibleColumnIdsForTableLayout() | string[] | Column ids currently displayed in a Table Layout. |
| getCurrentVisibleColumnIdsMapForTableLayout() | \{ [key: string]: boolean; \} | Column ids in the current Table Layout. |
| getExtendedLayoutByName(layoutName) | ExtendedLayout | undefined | Retrieves the Layout with the given name, together with the objects extended into it (global objects, which apply in every Layout, are not included) |
| getLayoutById(id) | Layout | Retrieves Layout by by the technical ID (from LayoutState) |
| getLayoutByName(layoutName) | Layout | null | Retrieves Layout with the given name |
| getLayoutExtensions(layoutName) | LayoutExtensionInfo | Retrieves the names of the objects, per Module, extended into a Layout |
| getLayouts() | Layout[] | Retrieves all Layouts in Adaptable State |
| getLayoutsForObject(object, module) | string[] | Retrieves the names of the Layouts an object is extended into (empty when the object is global) |
| getLayoutState() | LayoutState | The Layout section of Adaptable State. |
| isCurrentLayoutPivot() | boolean | Whether the current Layout is a Pivot Layout. |
| openLayoutSettingsPanel() | void | Opens Settings Panel with Layout section selected |
| removeColumnFromCurrentLayout(columnId) | void | Removes a Column from Current Table or Pivot Layout |
| removeObjectFromLayout(object, module, layoutName) | void | Removes an object from a Layout - when it is no longer extended into any Layout, it becomes global |
| renameLayout(layoutName, newLayoutName) | boolean | Renames a Layout, keeping the objects extended into it |
| saveCurrentLayout() | void | Saves current Layout - using column order, visibility, sorting etc. currently in use in the grid |
| setColumnCaption(columnId, caption) | void | Sets a new Caption / Header for a Column (only for current Layout) |
| setExtendedLayout(extendedLayout) | void | Sets (i.e. selects) the Extended Layout |
| setLayout(layoutName) | void | Sets (i.e. selects) the Layout |
| setLayoutExtensions(layoutName, extensionInfo) | void | Replaces the objects extended into a Layout (an empty extensionInfo makes those objects global again, unless they are extended into other Layouts) |
| setLayoutsForObject(object, module, layoutNames) | void | Extends an object into exactly the given Layouts, removing it from any others |
| showChangeColumnCaption(column) | void | Opens Change Column Caption popup |
| showLayoutEditor(layoutName, layoutType, action) | void | Opens Layout Editor - for Current or a named Layout |
| updateCurrentLayout(updateFn) | void | Updates current Layout using the partial Layout props provided in a function |
Method Details
addColumnToCurrentLayout
Adds a Column to Current Table or Pivot Layout
addColumnToCurrentLayout(columnId: string): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| columnId | string | Column to add |
Returns
void
addObjectToLayout
Extends an object into a Layout - once extended into any Layout, it applies only in those Layouts
addObjectToLayout(object: LayoutExtensionObject, module: LayoutExtensionModule, layoutName?: string): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| object | LayoutExtensionObject | Object to extend |
| module | LayoutExtensionModule | Module the object belongs to |
| layoutName | string | Layout to extend it into; defaults to Current Layout |
Returns
void
cloneAndSetLayout
Creates new Layout by cloning a given Layout and then loads it into Grid
cloneAndSetLayout(layoutToClone: Layout, layoutName: string): Layout | false;Parameters
| Parameter | Type | Description |
|---|---|---|
| layoutToClone | Layout | Layout to clone |
| layoutName | string | name to use for new Layout |
Returns
created Layout object or false if creation failed
Layout | false
cloneExtendedLayout
Clones an Extended Layout - the new Layout is extended with the same objects
cloneExtendedLayout(extendedLayoutToClone: ExtendedLayout, layoutName: string): ExtendedLayout | false;Parameters
| Parameter | Type | Description |
|---|---|---|
| extendedLayoutToClone | ExtendedLayout | ExtendedLayout to Clone |
| layoutName | string | New name for Layout being cloned |
Returns
The cloned Extended Layout, or false when the source does not exist or the new name is already used
ExtendedLayout | false
cloneLayout
Creates new Layout by cloning a given Layout
cloneLayout(layoutToClone: Layout, layoutName: string): Layout | false;Parameters
| Parameter | Type | Description |
|---|---|---|
| layoutToClone | Layout | Layout to clone |
| layoutName | string | name of new Layout |
Returns
created Layout object or false if creation failed
Layout | false
createAndSetLayout
Creates new Layout and loads it into Grid
createAndSetLayout(layoutToCreate: Layout): Layout | false;Parameters
| Parameter | Type | Description |
|---|---|---|
| layoutToCreate | Layout | Layout to create |
Returns
created Layout object or false if creation failed
Layout | false
createLayout
Creates a new Layout
createLayout(layoutToCreate: Layout): Layout | false;Parameters
| Parameter | Type | Description |
|---|---|---|
| layoutToCreate | Layout | Layout to create |
Returns
created Layout object or false if Layout with the same name/Uuid already exists
Layout | false
createOrUpdateExtendedLayout
Creates (or Updates) an Extended Layout: saves the Layout, adds any extension objects not yet in state, and makes those objects the Layout's complete Layout Extension
createOrUpdateExtendedLayout(extendedLayout: ExtendedLayout): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| extendedLayout | ExtendedLayout | ExtendedLayout to Create |
Returns
void
createOrUpdateLayout
Creates new Layout into Adaptable State or updates an existing Layout (with same name or id)
createOrUpdateLayout(layout: Layout): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| layout | Layout | the Layout to create or update |
Returns
void
deleteLayout
Deletes an existing Layout (if not Default or only existing Layout)
deleteLayout(layout: Layout): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| layout | Layout | The Layout to delete |
Returns
void
deleteLayoutByName
Deletes a Layout by name. Does nothing when it is the only Layout.
deleteLayoutByName(layoutName: string): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| layoutName | string | Name of the Layout to delete |
Returns
void
doesLayoutExist
Whether this Layout is already in Layout State. Compared by Uuid.
doesLayoutExist(layout: Layout): boolean;Parameters
| Parameter | Type | Description |
|---|---|---|
| layout | Layout | Layout to check |
Returns
true when a Layout with the same Uuid is in state
boolean
getCurrentLayout
Retrieves Current Layout from Layout State
getCurrentLayout(): Layout;Returns
layout
getCurrentLayoutColumnSort
The sort direction of a column in the current Layout.
getCurrentLayoutColumnSort(columnId: string): ColumnSort['SortOrder'] | null;Parameters
| Parameter | Type | Description |
|---|---|---|
| columnId | string | Column to read |
Returns
'Asc' or 'Desc', or null when the column is not sorted in this Layout
ColumnSort['SortOrder'] | null
getCurrentLayoutName
Name of the Layout that is selected.
getCurrentLayoutName(): string;Returns
The current Layout name
string
getCurrentRowGroupsColumnIds
Columns that group rows in the current Layout.
getCurrentRowGroupsColumnIds(): string[];Returns
RowGroupedColumns for a Table Layout, or PivotGroupedColumns for a Pivot Layout
string[]
getCurrentVisibleColumnIdsForPivotLayout
Column ids currently displayed in a Pivot Layout.
getCurrentVisibleColumnIdsForPivotLayout(): string[];Returns
The displayed column ids, including pivot result columns. Empty when the current Layout is a Table Layout
string[]
getCurrentVisibleColumnIdsForTableLayout
Column ids currently displayed in a Table Layout.
getCurrentVisibleColumnIdsForTableLayout(): string[];Returns
The displayed column ids. Empty when the current Layout is a Pivot Layout
string[]
getCurrentVisibleColumnIdsMapForTableLayout
Column ids in the current Table Layout.
getCurrentVisibleColumnIdsMapForTableLayout(): {
[key: string]: boolean;
};Returns
Each Table Layout column id mapped to true. An empty object when the current Layout is a Pivot Layout
\{ [key: string]: boolean; \}
getExtendedLayoutByName
Retrieves the Layout with the given name, together with the objects extended into it (global objects, which apply in every Layout, are not included)
getExtendedLayoutByName(layoutName: string): ExtendedLayout | undefined;Parameters
| Parameter | Type | Description |
|---|---|---|
| layoutName | string | Layout to retrieve |
Returns
The Layout and the objects extended into it, or undefined when no Layout has that name. Objects that apply in every Layout are not included
ExtendedLayout | undefined
getLayoutById
Retrieves Layout by by the technical ID (from LayoutState)
getLayoutById(id: Layout['Uuid']): Layout;Parameters
| Parameter | Type | Description |
|---|---|---|
| id | Layout['Uuid'] | Layout id |
Returns
layout
getLayoutByName
Retrieves Layout with the given name
getLayoutByName(layoutName: string): Layout | null;Parameters
| Parameter | Type | Description |
|---|---|---|
| layoutName | string | Layout to retrieve |
Returns
layout
Layout | null
getLayoutExtensions
Retrieves the names of the objects, per Module, extended into a Layout
getLayoutExtensions(layoutName: string): LayoutExtensionInfo;Parameters
| Parameter | Type | Description |
|---|---|---|
| layoutName | string | Layout to check |
Returns
Object names grouped by module. Empty when the Layout has no extensions
getLayouts
Retrieves all Layouts in Adaptable State
getLayouts(): Layout[];Returns
layouts
Layout[]
getLayoutsForObject
Retrieves the names of the Layouts an object is extended into (empty when the object is global)
getLayoutsForObject(object: LayoutExtensionObject, module: LayoutExtensionModule): string[];Parameters
| Parameter | Type | Description |
|---|---|---|
| object | LayoutExtensionObject | Object to check |
| module | LayoutExtensionModule | Module the object belongs to |
Returns
Layout names the object is extended into. Empty when the object applies in every Layout
string[]
getLayoutState
The Layout section of Adaptable State.
getLayoutState(): LayoutState;Returns
Layouts and the name of the current Layout
isCurrentLayoutPivot
Whether the current Layout is a Pivot Layout.
isCurrentLayoutPivot(): boolean;Returns
true when the current Layout is a Pivot Layout
boolean
openLayoutSettingsPanel
Opens Settings Panel with Layout section selected
openLayoutSettingsPanel(): void;Returns
void
removeColumnFromCurrentLayout
Removes a Column from Current Table or Pivot Layout
removeColumnFromCurrentLayout(columnId: string): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| columnId | string | Column to remove |
Returns
void
removeObjectFromLayout
Removes an object from a Layout - when it is no longer extended into any Layout, it becomes global
removeObjectFromLayout(object: LayoutExtensionObject, module: LayoutExtensionModule, layoutName?: string): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| object | LayoutExtensionObject | Object to remove |
| module | LayoutExtensionModule | Module the object belongs to |
| layoutName | string | Layout to remove it from; defaults to Current Layout |
Returns
void
renameLayout
Renames a Layout, keeping the objects extended into it
renameLayout(layoutName: string, newLayoutName: string): boolean;Parameters
| Parameter | Type | Description |
|---|---|---|
| layoutName | string | Current name of the Layout |
| newLayoutName | string | New name (must not be used by another Layout) |
Returns
false if the Layout does not exist or the new name is taken
boolean
saveCurrentLayout
Saves current Layout - using column order, visibility, sorting etc. currently in use in the grid
saveCurrentLayout(): void;Returns
void
setColumnCaption
Sets a new Caption / Header for a Column (only for current Layout)
setColumnCaption(columnId: string, caption: string): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| columnId | string | Column to Update |
| caption | string | New Caption to display |
Returns
void
setExtendedLayout
Sets (i.e. selects) the Extended Layout
setExtendedLayout(extendedLayout: ExtendedLayout): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| extendedLayout | ExtendedLayout | Extended Layout to set |
Returns
void
setLayout
Sets (i.e. selects) the Layout
setLayout(layoutName: string): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| layoutName | string | Layout to set (has to be name of existing Layout) |
Returns
void
setLayoutExtensions
Replaces the objects extended into a Layout (an empty extensionInfo makes those objects global again, unless they are extended into other Layouts)
setLayoutExtensions(layoutName: string, extensionInfo: LayoutExtensionInfo): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| layoutName | string | Layout to update |
| extensionInfo | LayoutExtensionInfo | Names of the objects, per Module, to extend into the Layout |
Returns
void
setLayoutsForObject
Extends an object into exactly the given Layouts, removing it from any others
setLayoutsForObject(object: LayoutExtensionObject, module: LayoutExtensionModule, layoutNames: string[]): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| object | LayoutExtensionObject | Object to extend (referenced by its Name) |
| module | LayoutExtensionModule | Module the object belongs to |
| layoutNames | string[] | Layouts to extend the object into; an empty array makes the object global |
Returns
void
showChangeColumnCaption
Opens Change Column Caption popup
showChangeColumnCaption(column: AdaptableColumn): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| column | AdaptableColumn | Column to open Popup for |
Returns
void
showLayoutEditor
Opens Layout Editor - for Current or a named Layout
showLayoutEditor(layoutName?: string, layoutType?: 'table' | 'pivot',
action?: 'New' | 'Clone' | 'Edit'): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| layoutName | string | Name of the Layout to edit or clone. Omit it to use the current Layout |
| layoutType | 'table' | 'pivot' | 'table' or 'pivot'. Used when action is 'New' |
| action | 'New' | 'Clone' | 'Edit' | 'Edit', 'Clone' or 'New'. Defaults to 'Edit' |
Returns
void
updateCurrentLayout
Updates current Layout using the partial Layout props provided in a function
updateCurrentLayout(updateFn: (layout: TableLayout | PivotLayout) => TableLayout | PivotLayout): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| updateFn | (layout:TableLayout|PivotLayout) =>TableLayout|PivotLayout | a function which returns a full Layout |
Returns
void