Configuring AG Grid Column Defs at Design Time

Summary

  • AdapTable treats each AG Grid ColDef property on a case by case basis
  • This page anaylses the different use cases and the general principles involved

AG Grid users define the columns in the Grid using the colDefs property in Grid Options.

This step is mandatory for AdapTable users, also, who will then reference the ColDef Id in their Layouts.

However not all properties in ColDefs are treated equally by AdapTable - some are ignored, some are required and others are used only if the preferred alternative in AdapTable is not provided.

The full details of how AdapTable treats each ColDef property are listed below.

AG Grid and AdapTable each have a mechanism for developers to provide information about Grid Columns:

The fundamental difference between the 2 properties is Scope Usage.

Important

  • ColDefs set full and exclusive Column behaviour for the lifetime of the Application
  • Layouts support multiple, mutually exclusive use cases - Columns can behave differently in different Layouts

Because AdapTable supports multiple Layouts, it cannot simply just read the properties defined in ColDefs.

Note

  • This is because 2 different Layouts might want to treat the same Column property differently
  • For instance it is very common to set different visibility, column order, or row grouping in different Layouts

As a result, AdapTable needs to decide on initial Layout behaviour on a per-ColDef property basis.

Essentially, AdapTable responds to AG Grid ColDef properties in 3 different ways.

Depending on the use case, it will do one of the following for each property:

  • ignore - the property is never invoked or used
  • respect - if provided, AdapTable will use it in its own functionality

Caution

  • AdapTable generally ignores ColDef props that sets same values as available in Layouts, e.g. group, pivot, pin
  • But respects (usually in Layout Editor) ColDef props that set behaviour e.g. enableGroup, enableValue, resizable
  • fall back on - property still works if AdapTable's preferred implementation is not provided

Note

  • The majorify of AG Grid's ColDef properties do not appear in any of these 3 lists
  • This is because AdapTable has no direct relationship with them, and they perform their intended AG Grid purpose

Ignored

There are some ColDef properties which AdapTable simply ignores - they are never read nor acted upon.

The intended behaviour needs, instead, to be provided via AdapTable's Layout properties.

Pivoting

ColDefAG Grid PurposeAdapTable Layout Behaviour
pivotPivots a ColumnOnly columns in PivotColumns are pivoted
initialPivotPivots new ColumnOnly columns in PivotColumns are pivoted
pivotIndexPivot Column indexColumns are pivoted by PivotColumns order
initialPivotIndexNew Pivot Column indexColumns are pivoted by PivotColumns order

Row Grouping

ColDefAG Grid PurposeAdapTable Layout Behaviour
rowGroupGroups a ColumnOnly columns in RowGroupColumns are grouped
initialRowGroupGroups new ColumnOnly columns in RowGroupColumns are grouped
rowGroupIndexGrouped Column indexColumns grouped by RowGroupColumns order
initialRowGroupIndexNew Grouped Column indexColumns grouped by RowGroupColumns order

Aggregating

ColDefAG Grid PurposeAdapTable Layout Behaviour
aggFuncAgg FuncOnly Aggregations in TableAggregationColumns are evaluated
initialAggFuncNew Agg FuncOnly Aggregations in TableAggregationColumns are evaluated

Pinning

ColDefAG Grid PurposeAdapTable Layout Behaviour
pinnedPins a ColumnOnly columns in ColumnPinning are pinned
initialPinnedPins new ColumnOnly columns in ColumnPinning are pinned
lockPinnedPrevents Pinning a ColumnColumn can still be pinned in Layout and UI

Sorting

ColDefAG Grid PurposeAdapTable Layout Behaviour
sortSorts a ColumnOnly columns in ColumnSorts are sorted
initialSortSorts new ColumnOnly columns in ColumnSorts are sorted
sortIndexSorted Column indexColumns sorted by the order in ColumnSorts
initialSortIndexNew Sorted Column indexColumns sorted by the order in ColumnSorts
sortingOrderOrder of Sort DirectionsSort Directions provided in ColumnSorts

Visibility

ColDefAG Grid PurposeAdapTable Layout Behaviour
hideHides a ColumnAny column in TableColumns is visible (unless overridden in ColumnVisibility)
initialHideHides a new ColumnAny column in TableColumns is visible (unless overridden in ColumnVisibility)

Sizing

ColDefAG Grid PurposeAdapTable Layout Behaviour
initialWidthWidth for new ColumnsOnly sizing in ColumnSizing is used
initialFlexFlex for new ColumnsOnly sizing in ColumnSizing is used

Note

  • Unlike with most other ColDef properties that have values, flex and width are not ignored by AdapTable
  • Instead they are used if the Column's property is not explicitly overridden in the Layout's ColumnSizing

Leveraged

There are many ColDef properties which, if provided, are respected - and used - by AdapTable:

ColDefAG Grid PurposeAdapTable Behaviour
fieldFinds item in Grid Data SourceBecomes Adaptable Column field property
colIdUnique Id for ColumnBecomes Adaptable Column columnId property
typeUsed for Column TemplatingUsed for Column Types Scope
cellDataTypeColumn's data typeUsed to infer Adaptable Column's Data Type
enablePivotColumn is Pivotable in UIRespected by Pivot Layout UI Wizard
enableRowGroupColumn is Groupable in UIRespected by Table Layout UI Wizard
enableValueColumn is Aggregatable in UIRespected by Pivot Layout UI Wizard
defaultAggFuncDefault Agg FuncRespected by Table Layout UI Wizard
allowedAggFuncsAllowed Agg FuncsRespected by Table Layout UI Wizard
sortableColumn is Sortable in UIRespected by Table Layout UI Wizard
resizableColumn is Resizable in UIRespected by Table Layout UI Wizard
suppressMovableColumn is not Movable in UIRespected by Table Layout UI Wizard

Note

The resizable property is only used if it is not explicitly overridden by Resizable in the Layout's ColumnSizing object


AdapTable Preference

There are a few AG Grid ColDef properties for which AdapTable provides an alternative implementation.

These properties will be evaluated, but only if the AdapTable equivalent has not been provided.

Note

  • We strongly recommend using the AdapTable equivalent in all these use cases where possible
  • Any objects created are saved to AdapTable State and there is tight integration with other AdapTable features
ColDefAG Grid PurposePreferred AdapTable Equivalent
valueFormatterFormats a CellDisplay Formats
comparatorProvides custom sortCustom Sort
editableSets Column EditabilityAdapTable Cell Editability

In addition, the Layout's ColumnSizing object contains 5 properties which override ColDef props.

However if one of these is not provided, then the ColDef equivalent is used instead:

AdapTable ColumnSizing Property Used if ProvidedColDef Fallback property
Flexflex
Widthwidth
MinWidthminWidth
MaxWidthmaxWidth