Layout Technical Reference

Summary

  • Layout State enables Table and Pivot Layouts to be configured
  • Layout Options contains many Layout related features
  • The Layout API contains many Layout-related functions

Layout State

Layout State contains a collection of Layouts and the Current Layout:

PropertyTypeDescription
CurrentLayoutstringLayout to be loaded when AdapTable starts (using Name property in Layout); if not provided the first Layout is used
LayoutsLayoutArrayCollection of Layouts - can be Table or Pivot

Base Layout Object

All Layouts derive from the LayoutBase object defined as follows:

PropertyTypeDescription
AutoSizeColumnsbooleanWhether Columns should autosize when Layout first loads
ColumnFiltersColumnFilter[]Collection of Column Filters to apply in Layout
ColumnGroupValuesColumnGroupValuesDefines which Column Groups are expanded / collapsed
ColumnHeadersColumnStringMapSet of custom header names for some (or all) Columns
ColumnPinningColumnDirectionMapDetails of which Columns are pinned
ColumnSizingColumnSizingMapControls size (width or flex & min/max) for Columns
ColumnSortsColumnSort[]Sorting to apply in the Layout
GrandTotalRow'top' | 'bottom' | 'pinnedTop' | 'pinnedBottom' | booleanPosition of the Grand Total Row in the Layout
GridFilterGridFilterGrid Filter to apply in Layout
NamestringName of the Layout as it appears in the Layout toolbar and tool panel
OpenChartsLayoutOpenChart[]AG Grid charts to open when this layout is selected (by chart UUID or name)
RowGroupDisplayTypeRowGroupDisplayType
RowGroupValuesRowGroupValuesDefines which Row Groups are expanded / collapsed
RowSelectionLayoutRowSelection | falseDefines Row Selection behaviour for Layout; if false, Row Selection is disabled; if undefined, GridOptions is used
SuppressAggFuncInHeaderbooleanHides the aggFunc in Column header: e.g. 'sum(Price)' becomes 'Price'
IsReadOnlybooleanSets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full')

Table Layout Object

The Table Layout additionally includes these properties:

PropertyTypeDescription
ColumnVisibilityColumnBooleanFalseMapMap of Table Column Visibility
RowGroupedColumnsstring[]Columns which are row-grouped when the Layout is applied
RowSummariesRowSummary[]Pinned Rows that display Aggregation Info for a whole Column
TableAggregationColumnsTableAggregationColumnsColumns showing aggregated values in Grouped Rows; a record of ColumnId and aggfunc (e.g. sum) or 'true' (to use default aggfunc)
TableColumnsstring[]List of Column Ids to include in Table Layout
IsReadOnlybooleanSets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full')

Pivot Layout Object

The Pivot Layout additionally has:

PropertyTypeDescription
PivotAggregationColumnsPivotAggregationColumnsColumns showing aggregated values in Group Rows; 1st value in record is Column name, 2nd is either aggfunc (e.g. sum, avg etc.) or 'true' (to use default aggfunc)
PivotColumnsstring[]Mandatory list of Columns to pivot (provide empty array if just displaying Aggregations)
PivotColumnTotalPivotTotalPositionDisplay automatically calculated Totals within EACH Pivot Column Group, in the position specified
PivotExpandLevelnumberHow deep to expand Pivot Columns (0 for none, 1 for 1st level only etc, -1 to expand all)
PivotGrandTotalPivotTotalPositionDisplay automatically calculated Totals of all Pivot Columns, in the position specified
PivotGroupedColumnsstring[]Columns which are row-grouped when the Layout is applied
PivotResultColumnsOrderstring[] | booleanOrdered list of Pivot Result Columns; set to true to track current display order, or provide custom list
IsReadOnlybooleanSets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full')

Column Filter

The ColumnFilters property is a collection of ColumnFilter objects defined as follows:

PropertyTypeDescriptionDefault
ColumnIdstringColumn where Filter should be applied
PredicatesColumnFilterPredicate[]AdaptablePredicate which AdaptableQL will evaluate when the Filter is run
PredicatesOperatorPredicatesOperatorLogic used when combining multiple Predicates ('AND'|'OR')'AND'
IsReadOnlybooleanSets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full')
IsSuspendedbooleanSuspends (i.e. turns off) an Adaptable Object

Grid Filter

The GridFilter object is defined as follows:

PropertyTypeDescription
ExpressionstringThe (boolean) Expression to run
IsReadOnlybooleanSets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full')
IsSuspendedbooleanSuspends (i.e. turns off) an Adaptable Object

Column Sort

The ColumnSort object used for sorting is defined as follows:

PropertyTypeDescription
ColumnIdstringId of Column being sorted
SortOrder'Asc' | 'Desc'How Column is sorted - either 'Asc' or 'Desc'

Row Selection

The LayoutRowSelection object used for row selection is defined as follows:

PropertyTypeDescriptionDefault
CheckboxesbooleanWhether to display checkboxes in Selection Columntrue
CheckboxInGroupColumnbooleanRenders selection checkboxes in Auto-Group Column (if true) or in dedicated Selection Column (if false)false
EnableClickSelectionboolean | 'enableDeselection' | 'enableSelection'Selection behaviour when clicking a row: 'enableSelection' | 'enableDeselection' | true | falsefalse
GroupSelectModeGroupSelectionModeGrouping Select Mode: 'self' | 'descendants' | 'filteredDescendants''self'
HeaderCheckboxbooleanWhether to show checkbox in Header of Selection Column Header ('multiRow' only)true
Mode'singleRow' | 'multiRow'Row Selection Mode: 'singleRow' or 'multiRow'
SelectAllModeSelectAllModeSelect All Mode: 'all' | 'filtered' | 'currentPage''all'

Other Layout Properties

PropertyType
ColumnPinningColumnDirectionMap
ColumnSizingColumnSizingMap
ColumnVisibility (Table Layout only)ColumnBooleanFalseMap
ColumnHeadersColumnStringMap
RowGroupValuesRowGroupValues
ColumnGroupValuesColumnGroupValues

Note


Layout Options

The Layout Options section of Adaptable Options contains Layout-related configuration properties:

PropertyTypeDescription
layoutCreationDefaultPropertiesLayoutCreationDefaultProperties| ((context:LayoutCreationDefaultPropertiesContext) =>TableLayoutCreationDefaultProperties|PivotLayoutCreationDefaultProperties)Default properties to apply when creating a new Layout (Table or Pivot)
layoutTagOptionsLayoutTagOptionsSet of options for leveraging Object Tags to extend Layouts
layoutViewOptionsLayoutViewOptionsSet of options for how Layouts are displayed in Settings Panel
pivotPreviewColumnsstring[] | ((context:PivotPreviewColumnsContext) => string[])Columns to display in Table that opens when viewing Pivot Cell contents

Layout View Options

Layout View Options is used to configure how Layouts are viewed in the Settings Panel:

PropertyTypeDescriptionDefault
maxColumnsToDisplaynumberHow many Column Names to display in inline Layout preview10

Layout Tag Options

Layout Tag Options contains properties used when Extending Layouts:

PropertyTypeDescriptionDefault
autoCheckTagsForLayoutsbooleanAutomatically assumes that any LayoutExtensionObject is available in the current Layout if it has a tag with the Layouts name (or no tags at all)false
autoGenerateTagsForLayoutsboolean | ((context:AutoGenerateTagsForLayoutsContext) =>AdaptableObjectTag[])Automatically generate an AdaptableObjectTag for each Layoutfalse
isObjectExtendedInLayout(layoutExtendedContext:LayoutExtendedContext) => booleanChecks if provided Adaptable Object is extended in given Layout

Layout API

Full programmatic access to Layouts and related features is available in Layout API section of Adaptable API .

This enables Layouts to be accessed, created, edited, cloned, deleted and shared programmatically.

MethodReturnsDescription
addColumnToCurrentLayout(columnId)voidAdds a Column to Current Table or Pivot Layout
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
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
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 an existing Layout provided by Name (if not Default or only existing Layout)
doesLayoutExist(layout)booleanChecks whether this Layout exists in the Adaptable State (by comparing Uuid property)
getCurrentLayout()LayoutRetrieves Current Layout from Layout State
getCurrentLayoutColumnSort(columnId)ColumnSort['SortOrder'] | nullRetrieves the sort order of a column from the current layout
getCurrentLayoutName()stringRetrieves name of current Layout
getCurrentRowGroupsColumnIds()string[]Retrieves array of visible ColumnIds in current Layout
getCurrentVisibleColumnIdsForPivotLayout()string[]Retrieves array of visible ColumnIds in current Pivot Layout
getCurrentVisibleColumnIdsForTableLayout()string[]Retrieves array of visible ColumnIds in current Table Layout
getCurrentVisibleColumnIdsMapForTableLayout()\{ [key: string]: boolean; \}Retrieves map with visible columns in current Table Layout
getExtendedLayoutByName(layoutName)ExtendedLayout | undefinedRetrieves Layout with the given name
getLayoutById(id)LayoutRetrieves Layout by by the technical ID (from LayoutState)
getLayoutByName(layoutName)Layout | nullRetrieves Layout with the given name
getLayouts()Layout[]Retrieves all Layouts in Adaptable State
getLayoutState()LayoutStateRetrieves Layout section from Adaptable State
isCurrentLayoutPivot()booleanReturns true if 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
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
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