Below are listed all the column API methods.
Some of the API methods take Column Key (named colKey) which has type Column | string. This means you can pass either a Column object (that you receive from calling one of the other methods) or you pass in the Column ID (which is a string). The Column ID is a property of the column definition. If you do not provide the Column ID, the grid will create one for you (first by trying to use the field if it is unique, otherwise it will generate an ID).
sizeColumnsToFit(width)sizeColumnsToFix(900). To have the grid fit the columns to the grid's width, use the Grid API gridApi.sizeColumnsToFit() instead.setColumnGroupOpened(group, newValue)getColumnGroup(name)getDisplayNameForColumn(column)headerValueGetter is used, or if you are doing your own column management GUI, to know what to show as the column name.getDisplayNameForColumnGroup(columnGroup)getColumn(colKey)colKey, which can either be the colId (a string) or the colDef (an object).getColumnState()applyColumnState(params)false if one or more columns could not be found.resetColumnState()getColumnGroupState()setColumnGroupState(columnState)resetColumnGroupState()isPinning()true if pinning left or right, otherwise false.isPinningLeft()true if pinning left, otherwise false.isPinningRight()true if pinning right, otherwise false.getDisplayedColAfter(col)getDisplayedColBefore(col)getVisibleColAfter except gives column to the left.setColumnVisible(colKey, visible)Column object.setColumnsVisible(colKeys, visible)setColumnVisible, but provide a list of column keys.setColumnPinned(colKey, pinned)ColDef object or Column object.setColumnsPinned(colKeys, pinned)setColumnPinned, but provide a list of column keys.autoSizeColumn(colKey, skipHeader)autoSizeColumns(colKeys, skipHeader)autoSizeColumn, but provide a list of column keys.autoSizeAllColumns(skipHeader)autoSizeColumns on all displayed columns.getAllColumns()getAllGridColumns()getAllColumns(), except a) it has the order of the columns that are presented in the grid and b) it's after the 'pivot' step, so if pivoting, has the value columns for the pivot.getPrimaryColumns()getSecondaryColumns()getAllDisplayedVirtualColumns()getAllGridColumns(), except only returns rendered columns, i.e. columns that are not within the viewport and therefore not rendered, due to column virtualisation, are not displayed.getDisplayedCenterColumns()
getDisplayedLeftColumns()
getDisplayedRightColumns()
getAllDisplayedColumns()getLeftDisplayedColumnGroups()
getCenterDisplayedColumnGroups()
getRightDisplayedColumnGroups()
getAllDisplayedColumnGroups()moveColumn(colKey, toIndex)toIndex. The column is first removed, then added at the toIndex location, thus index locations will change to the right of the column after the removal.moveColumns(colKeys[], toIndex)moveColumn but works on list.moveColumnByIndex(fromIndex, toIndex)moveColumn but works on index locations.setColumnAggFunc(column, aggFunc)aggFunc can be one of 'min' | 'max' | 'sum'>.setColumnWidth(colKey, newWidth, finished = true)columnWidth events, so the consumer of events knows when it receives the last event in a stream. The finished parameter is optional, and defaults to true.setColumnWidths(columnWidths: {colKey, newWidth}[], finished = true)setColumnWidth multiple times. The finished flag gets included in the resulting event and not used internally by the grid. The finished flag is intended for dragging, where a dragging action will produce many columnWidth events, so the consumer of events knows when it receives the last event in a stream. The finished parameter is optional, and defaults to true.getRowGroupColumns()
addRowGroupColumn(colKey)
addRowGroupColumns(colKeys)
removeRowGroupColumn(colKey)
removeRowGroupColumns(colKeys)
setRowGroupColumns(colKeys)
moveRowGroupColumn(fromIndex, toIndex)getPivotColumns()
setPivotColumns(colKeys)
removePivotColumn()
removePivotColumns(colKeys)
addPivotColumn(colKey)
addPivotColumns(colKeys)isPivotMode()
setPivotMode(mode)getSecondaryPivotColumn(pivotKeys, valueColId)pivotKeys and valueColId. Useful to then call operations on the pivot column.getValueColumns()
removeValueColumn(colKey)
removeValueColumns(colKeys)
addValueColumn(colKey)
addValueColumns(colKeys)