LayoutApi

View as Markdown

Table and Pivot Layouts: the layout that is selected, its columns, sorts and row groups, and creating, cloning, editing and deleting layouts.

TypeScript
export interface

Methods

MethodReturnsDescription
addColumnToCurrentLayout(columnId)voidAdds a Column to Current Table or Pivot Layout
addObjectToLayout(object, module, layoutName)voidExtends an object into a Layout - once extended into any Layout, it applies only in those Layouts
cloneAndSetLayout(layoutToClone, layoutName)Layout | falseCreates new Layout by cloning a given Layout and then loads it into Grid
cloneExtendedLayout(extendedLayoutToClone, layoutName)ExtendedLayout | falseClones an Extended Layout - the new Layout is extended with the same objects
cloneLayout(layoutToClone, layoutName)Layout | falseCreates new Layout by cloning a given Layout
createAndSetLayout(layoutToCreate)Layout | falseCreates new Layout and loads it into Grid
createLayout(layoutToCreate)Layout | falseCreates a new Layout
createOrUpdateExtendedLayout(extendedLayout)voidCreates (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)voidCreates new Layout into Adaptable State or updates an existing Layout (with same name or id)
deleteLayout(layout)voidDeletes an existing Layout (if not Default or only existing Layout)
deleteLayoutByName(layoutName)voidDeletes a Layout by name. Does nothing when it is the only Layout.
doesLayoutExist(layout)booleanWhether this Layout is already in Layout State. Compared by Uuid.
getCurrentLayout()LayoutRetrieves Current Layout from Layout State
getCurrentLayoutColumnSort(columnId)ColumnSort['SortOrder'] | nullThe sort direction of a column in the current Layout.
getCurrentLayoutName()stringName 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 | undefinedRetrieves 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)LayoutRetrieves Layout by by the technical ID (from LayoutState)
getLayoutByName(layoutName)Layout | nullRetrieves Layout with the given name
getLayoutExtensions(layoutName)LayoutExtensionInfoRetrieves 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()LayoutStateThe Layout section of Adaptable State.
isCurrentLayoutPivot()booleanWhether the current Layout is a Pivot Layout.
openLayoutSettingsPanel()voidOpens Settings Panel with Layout section selected
removeColumnFromCurrentLayout(columnId)voidRemoves a Column from Current Table or Pivot Layout
removeObjectFromLayout(object, module, layoutName)voidRemoves an object from a Layout - when it is no longer extended into any Layout, it becomes global
renameLayout(layoutName, newLayoutName)booleanRenames a Layout, keeping the objects extended into it
saveCurrentLayout()voidSaves current Layout - using column order, visibility, sorting etc. currently in use in the grid
setColumnCaption(columnId, caption)voidSets a new Caption / Header for a Column (only for current Layout)
setExtendedLayout(extendedLayout)voidSets (i.e. selects) the Extended Layout
setLayout(layoutName)voidSets (i.e. selects) the Layout
setLayoutExtensions(layoutName, extensionInfo)voidReplaces 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)voidExtends an object into exactly the given Layouts, removing it from any others
showChangeColumnCaption(column)voidOpens Change Column Caption popup
showLayoutEditor(layoutName, layoutType, action)voidOpens Layout Editor - for Current or a named Layout
updateCurrentLayout(updateFn)voidUpdates current Layout using the partial Layout props provided in a function

Method Details

addColumnToCurrentLayout

Adds a Column to Current Table or Pivot Layout

TypeScript
addColumnToCurrentLayout(columnId: string): void;
Parameters
ParameterTypeDescription
columnIdstringColumn to add
Returns

void

addObjectToLayout

Extends an object into a Layout - once extended into any Layout, it applies only in those Layouts

TypeScript
addObjectToLayout(object: LayoutExtensionObject, module: LayoutExtensionModule, layoutName?: string): void;
Parameters
ParameterTypeDescription
objectLayoutExtensionObjectObject to extend
moduleLayoutExtensionModuleModule the object belongs to
layoutNamestringLayout 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

TypeScript
cloneAndSetLayout(layoutToClone: Layout, layoutName: string): Layout | false;
Parameters
ParameterTypeDescription
layoutToCloneLayoutLayout to clone
layoutNamestringname 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

TypeScript
cloneExtendedLayout(extendedLayoutToClone: ExtendedLayout, layoutName: string): ExtendedLayout | false;
Parameters
ParameterTypeDescription
extendedLayoutToCloneExtendedLayoutExtendedLayout to Clone
layoutNamestringNew 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

TypeScript
cloneLayout(layoutToClone: Layout, layoutName: string): Layout | false;
Parameters
ParameterTypeDescription
layoutToCloneLayoutLayout to clone
layoutNamestringname of new Layout
Returns

created Layout object or false if creation failed

Layout | false

createAndSetLayout

Creates new Layout and loads it into Grid

TypeScript
createAndSetLayout(layoutToCreate: Layout): Layout | false;
Parameters
ParameterTypeDescription
layoutToCreateLayoutLayout to create
Returns

created Layout object or false if creation failed

Layout | false

createLayout

Creates a new Layout

TypeScript
createLayout(layoutToCreate: Layout): Layout | false;
Parameters
ParameterTypeDescription
layoutToCreateLayoutLayout 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

TypeScript
createOrUpdateExtendedLayout(extendedLayout: ExtendedLayout): void;
Parameters
ParameterTypeDescription
extendedLayoutExtendedLayoutExtendedLayout to Create
Returns

void

createOrUpdateLayout

Creates new Layout into Adaptable State or updates an existing Layout (with same name or id)

TypeScript
createOrUpdateLayout(layout: Layout): void;
Parameters
ParameterTypeDescription
layoutLayoutthe Layout to create or update
Returns

void

deleteLayout

Deletes an existing Layout (if not Default or only existing Layout)

TypeScript
deleteLayout(layout: Layout): void;
Parameters
ParameterTypeDescription
layoutLayoutThe Layout to delete
Returns

void

deleteLayoutByName

Deletes a Layout by name. Does nothing when it is the only Layout.

TypeScript
deleteLayoutByName(layoutName: string): void;
Parameters
ParameterTypeDescription
layoutNamestringName of the Layout to delete
Returns

void

doesLayoutExist

Whether this Layout is already in Layout State. Compared by Uuid.

TypeScript
doesLayoutExist(layout: Layout): boolean;
Parameters
ParameterTypeDescription
layoutLayoutLayout to check
Returns

true when a Layout with the same Uuid is in state

boolean

getCurrentLayout

Retrieves Current Layout from Layout State

TypeScript
getCurrentLayout(): Layout;
Returns

layout

Layout

getCurrentLayoutColumnSort

The sort direction of a column in the current Layout.

TypeScript
getCurrentLayoutColumnSort(columnId: string): ColumnSort['SortOrder'] | null;
Parameters
ParameterTypeDescription
columnIdstringColumn 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.

TypeScript
getCurrentLayoutName(): string;
Returns

The current Layout name

string

getCurrentRowGroupsColumnIds

Columns that group rows in the current Layout.

TypeScript
getCurrentRowGroupsColumnIds(): string[];
Returns

RowGroupedColumns for a Table Layout, or PivotGroupedColumns for a Pivot Layout

string[]

getCurrentVisibleColumnIdsForPivotLayout

Column ids currently displayed in a Pivot Layout.

TypeScript
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.

TypeScript
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.

TypeScript
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)

TypeScript
getExtendedLayoutByName(layoutName: string): ExtendedLayout | undefined;
Parameters
ParameterTypeDescription
layoutNamestringLayout 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)

TypeScript
getLayoutById(id: Layout['Uuid']): Layout;
Parameters
ParameterTypeDescription
idLayout['Uuid']Layout id
Returns

layout

Layout

getLayoutByName

Retrieves Layout with the given name

TypeScript
getLayoutByName(layoutName: string): Layout | null;
Parameters
ParameterTypeDescription
layoutNamestringLayout to retrieve
Returns

layout

Layout | null

getLayoutExtensions

Retrieves the names of the objects, per Module, extended into a Layout

TypeScript
getLayoutExtensions(layoutName: string): LayoutExtensionInfo;
Parameters
ParameterTypeDescription
layoutNamestringLayout to check
Returns

Object names grouped by module. Empty when the Layout has no extensions

LayoutExtensionInfo

getLayouts

Retrieves all Layouts in Adaptable State

TypeScript
getLayouts(): Layout[];
Returns

layouts

Layout[]

getLayoutsForObject

Retrieves the names of the Layouts an object is extended into (empty when the object is global)

TypeScript
getLayoutsForObject(object: LayoutExtensionObject, module: LayoutExtensionModule): string[];
Parameters
ParameterTypeDescription
objectLayoutExtensionObjectObject to check
moduleLayoutExtensionModuleModule 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.

TypeScript
getLayoutState(): LayoutState;
Returns

Layouts and the name of the current Layout

LayoutState

isCurrentLayoutPivot

Whether the current Layout is a Pivot Layout.

TypeScript
isCurrentLayoutPivot(): boolean;
Returns

true when the current Layout is a Pivot Layout

boolean

openLayoutSettingsPanel

Opens Settings Panel with Layout section selected

TypeScript
openLayoutSettingsPanel(): void;
Returns

void

removeColumnFromCurrentLayout

Removes a Column from Current Table or Pivot Layout

TypeScript
removeColumnFromCurrentLayout(columnId: string): void;
Parameters
ParameterTypeDescription
columnIdstringColumn to remove
Returns

void

removeObjectFromLayout

Removes an object from a Layout - when it is no longer extended into any Layout, it becomes global

TypeScript
removeObjectFromLayout(object: LayoutExtensionObject, module: LayoutExtensionModule, layoutName?: string): void;
Parameters
ParameterTypeDescription
objectLayoutExtensionObjectObject to remove
moduleLayoutExtensionModuleModule the object belongs to
layoutNamestringLayout to remove it from; defaults to Current Layout
Returns

void

renameLayout

Renames a Layout, keeping the objects extended into it

TypeScript
renameLayout(layoutName: string, newLayoutName: string): boolean;
Parameters
ParameterTypeDescription
layoutNamestringCurrent name of the Layout
newLayoutNamestringNew 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

TypeScript
saveCurrentLayout(): void;
Returns

void

setColumnCaption

Sets a new Caption / Header for a Column (only for current Layout)

TypeScript
setColumnCaption(columnId: string, caption: string): void;
Parameters
ParameterTypeDescription
columnIdstringColumn to Update
captionstringNew Caption to display
Returns

void

setExtendedLayout

Sets (i.e. selects) the Extended Layout

TypeScript
setExtendedLayout(extendedLayout: ExtendedLayout): void;
Parameters
ParameterTypeDescription
extendedLayoutExtendedLayoutExtended Layout to set
Returns

void

setLayout

Sets (i.e. selects) the Layout

TypeScript
setLayout(layoutName: string): void;
Parameters
ParameterTypeDescription
layoutNamestringLayout 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)

TypeScript
setLayoutExtensions(layoutName: string, extensionInfo: LayoutExtensionInfo): void;
Parameters
ParameterTypeDescription
layoutNamestringLayout to update
extensionInfoLayoutExtensionInfoNames 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

TypeScript
setLayoutsForObject(object: LayoutExtensionObject, module: LayoutExtensionModule, layoutNames: string[]): void;
Parameters
ParameterTypeDescription
objectLayoutExtensionObjectObject to extend (referenced by its Name)
moduleLayoutExtensionModuleModule the object belongs to
layoutNamesstring[]Layouts to extend the object into; an empty array makes the object global
Returns

void

showChangeColumnCaption

Opens Change Column Caption popup

TypeScript
showChangeColumnCaption(column: AdaptableColumn): void;
Parameters
ParameterTypeDescription
columnAdaptableColumnColumn to open Popup for
Returns

void

showLayoutEditor

Opens Layout Editor - for Current or a named Layout

TypeScript
showLayoutEditor(layoutName?: string, layoutType?: 'table' | 'pivot', 
    action?: 'New' | 'Clone' | 'Edit'): void;
Parameters
ParameterTypeDescription
layoutNamestringName 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

TypeScript
updateCurrentLayout(updateFn: (layout: TableLayout | PivotLayout) => TableLayout | PivotLayout): void;
Parameters
ParameterTypeDescription
updateFn(layout:TableLayout|PivotLayout) =>TableLayout|PivotLayouta function which returns a full Layout
Returns

void