Grid API


sizeColumnsToFit() Gets columns to adjust in size to fit the grid horizontally.
setColumnDefs(colDefs) Call to set new column definitions into the grid. The grid will redraw all the column headers, and then redraw all of the rows.


setRowData(rows) Set new rows into the grid.
updateRowData(transaction) Update row data into the grid. Pass a transaction object with lists for add, remove and update.
setDatasource(datasource) Set new datasource into the grid. The grid will reset all paging and load the first page. If you want to reset the paging but keep the datasource, call this method with the same datasource.
Methods for getting and setting the data and getting the Row Nodes of the pinned rows.
getModel() Returns the row model inside the table. From here you can see the original rows, rows after filter has been applied, rows after aggregation has been applied, and the final set of 'to be displayed' rows.
refreshClientSideRowModel(params) Gets the Client-side Row Model to refresh, executing the grouping, filtering and sorting again.

Accessing Row Nodes

getRowNode(id) Returns the row node with the given ID. The row node id is the one you provide with the callback getRowNodeId(data), otherwise the id is a number auto generated by the grid when the row data is set.
forEachNode((node, index)) Iterates through each node (row) in the grid and calls the callback for each node. This works similar to the 'forEach' method on a Javascript array. This is called for every node, ignoring any filtering or sorting applied within the grid. If using infinite row model, then gets called for each page loaded in the page cache.
forEachNodeAfterFilter((node, index)) Similar to forEachNode, except skips any filtered out data.
forEachNodeAfterFilterAndSort((node, index)) Similar to forEachNode, except skips any filtered out data and each the callback is called in the order the rows are displayed in the grid.
forEachLeafNode((node, index)) Similar to forEachNode, except lists all the leaf nodes. This effectively goes through all the data that you provided the grid before the grid did any grouping. If doing tree data, then goes through all the nodes for data you provided, including nodes that have children, but excluding groups the grid created where gaps were missing in the hierarchy.
getDisplayedRowAtIndex(index) Returns the displayed rowNode at the given index.
getDisplayedRowCount() Returns the total number of displayed rows.
getFirstDisplayedRow() Get the index of the first displayed row due to scrolling (includes not visible rendered rows in the buffer)
getLastDisplayedRow() Get the index of the last displayed row due to scrolling (includes not visible rendered rows in the buffer)

Master Detail

getDetailGridInfo(detailGridId) Returns the DetailGridInfo corresponding to the supplied detailGridId. See Master Detail for more details.
forEachDetailGridInfo(callback) Iterates through each DetailGridInfo in the grid and calls the supplied callback on each. See Master Detail for more details.


selectAll() Select all rows (even rows that are not visible due to grouping being enabled and their groups not expanded).
deselectAll() Clear all row selections.
selectAllFiltered() Select all filtered rows.
deselectAllFiltered() Clear all filtered selections.
getSelectedNodes() Returns a list of selected nodes. Getting the underlying node (rather than the data) is useful when working with tree / aggregated data, as the node can be traversed.
getSelectedRows() Returns a list of selected rows (ie row data that you provided).
getBestCostNodeSelection() Returns a list of all selected nodes at 'best cost' - a feature to be used with groups / trees. If a group has all its children selected, then the group appears in the result, but not the children. Designed for use with 'children' as the group selection type, where groups don't actually appear in the selection normally.
getCellRanges() Returns the list of selected cell ranges.
addCellRange(params) Adds to the selected range.
clearRangeSelection() Clears the selected range.


refreshCells(params) Gets the grid to do change detection on all cells and refresh the cell if needed.
redrawRows(params) Gets the grid to remove a row from the DOM and recreate it again from scratch.
refreshHeader() Redraws the header. Useful if a column name changes, or something else that changes how the column header is displayed.
flashCells(params) Flash rows, columns or individual cells. See Flashing Cells.

Sort & Filter

setQuickFilter(quickFilter) Pass a quick filter text into ag-Grid for filtering. If using Angular, the grid watched the 'quickFilterText' attribute of the gridOptions. If you won't want to use quickFilterText (ie if not using AngularJS) then you can call this method instead to apply a quick filter.
isQuickFilterPresent() Returns true if the quick filter is set, otherwise false.
isColumnFilterPresent() Returns true if any column filter is set, otherwise false.
isAnyFilterPresent() Returns true if any filter is set. This includes quick filter, advanced filter or external filter.
getFilterInstance(col) Returns the filter component instance for the column. Either provide the colDef (matches on object reference) or the column field attribute (matches on string comparison). Matching by field is normal. Matching by colDef is useful when field is missing or not unique.
getFilterModel() Gets the current state of all the advanced filters. Used for saving filter state.
setFilterModel(model) Sets the state of all the advanced filters. Provide it with what you get from getFilterModel() to restore filter state.
onFilterChanged() Informs the grid that a filter has changed. This is typically called after a filter change through one of the filter APIs.
destroyFilter() Destroys a filter, useful to create get a particular filter created from scratch again.
onSortChanged() Gets the grid to act as if the sort was changed. Useful if you update some values in the grid and want to get the grid to reorder them according to the new values.
setSortModel(model) Sets the sort state of the grid.
getSortModel() Returns the sort state of the grid.


getFocusedCell() Returns the focused cell as an object containing the rowIndex, column and floating (top, bottom or null).
setFocusedCell(rowIndex, colKey, floating) Sets the focus to the specified cell. Set floating to null, 'top', or 'bottom'.
clearFocusedCell() Clears the focused cell.
tabToNextCell() Navigates the grid focus to the next cell, as if tabbing.
tabToPreviousCell() Navigates the grid focus to the previous cell, as if shift-tabbing.


stopEditing(cancel?) If a cell is editing, it stops the editing. Pass 'true' if you want to cancel the editing (ie don't accept changes). See Editing API
startEditingCell(params) Gets the grid to start editing on a particular cell. See Editing API
getEditingCells() If the grid is editing, returns back details of the editing cell(s). See Editing API


exportDataAsCsv(params) Does a CSV export of the grid's data.
getDataAsCsv(params) Similar to exportDataAsCsv, except returns result as a string rather than export it.
exportDataAsExcel(params) Does a Excel export of the grid's data.
getDataAsExcel(params) Similar to exportDataAsExcel, except returns result as a string rather than export it.


addEventListener(eventType, listener) Add an event listener for the said event type. Works similar to addEventListener for a browser DOM element.
addGlobalListener(listener) Add an event listener for all event types coming from the grid.
removeEventListener(eventType, listener) Remove an event listener.
removeGlobalListener(listener) Remove a global event listener.
dispatchEvent(event) Dispatch an event through the grid. Useful if you are doing a custom cellRenderer and want to fire events such as 'cellValueChanged'.

Row Groups

expandAll() Expand all groups.
collapseAll() Collapse all groups.
setRowNodeExpanded(rowNode, expanded) Expand or collapse a specific row node.
onGroupExpandedOrCollapsed() If after getting the model, you expand or collapse a group, call this method to inform the grid. It will work out the final set of 'to be displayed' rows again (ie expand or collapse the group visually).


getRenderedNodes() Retrieve rendered nodes. Due to virtualisation this will contain only the current visible rows and the amount in the buffer.
getCellRendererInstances(params) Returns back the list of active Cell Renderer Instances.
getCellEditorInstances(params) Returns back the list of active Cell Editor Instances.


setAlwaysShowVerticalScroll(show) If true, the vertical scrollbar will always be present even if not required, otherwise, it will only be displayed when necessary.
ensureIndexVisible(index, position) Ensures the row index is visible by vertically scrolling the grid. The valid values for positions are {'top', 'middle', 'bottom', undefined/null}. If top, middle or bottom, the grid will scroll the row to place the row at top, middle or bottom. If undefined or null then grid will do the minimum scrolling to show the row, ie if grid needs to scroll up then it will scroll so that the row is at the top, if the grid needs to scroll down then it will scroll so that the row is at the bottom, if the row is already in view then the grid will do nothing.
ensureNodeVisible(comparator, position) Ensures a node is visible, scrolling the table if needed. Provide one of a) the node b) the data object c) a comparator function (that takes the node as a parameter, and returns true for match, false for no match). The valid values for positions are same as for api.ensureIndexVisible().
ensureColumnVisible(colId) Ensures the column is visible, scrolling the table if needed.
getHorizontalPixelRange() Returns a JSON object with two properties:
  • left: The left pixel position of the current scroll in the grid
  • right: The right pixel position of the current scroll in the grid
getVerticalPixelRange() Returns a JSON object with two properties:
  • top: The top pixel position of the current scroll in the grid
  • bottom: The bottom pixel position of the current scroll in the grid


showLoadingOverlay() Show the loading overlay.
showNoRowsOverlay() Show the 'no rows' overlay.
hideOverlay() Hides the overlay if showing.


copySelectedRangeToClipboard(includeHeaders) Copies the selected ranges to the clipboard.
copySelectedRangeDown() Copies the selected range down, similar to Ctrl+D in Excel.



Returns true when last page known. This will always be true if you are using the Client-side Row Model for pagination.

Returns false when last page now known. This only happens when using Infinite Scrolling Row Model.


How many rows ag-Grid is showing per page.


Sets the paginationPageSize to newPageSize Then it repaginates the grid so the changes are applied immediately on the screen.


Returns the 0 index based page which ag-Grid is showing right now.


Returns the total number of pages. If paginationIsLastPageFound() == false returns null.


The total number of rows. If paginationIsLastPageFound() == false returns null.


Goes to the specified page. If the page requested doesn't exist, it will go to the last page.


Shorthands for goToPage(relevantPageNumber).


setHeaderHeight(heightInPx) Sets the height for the row containing the column label header.
setGroupHeaderHeight(heightInPx) Sets the height for the rows containing header column groups.
setFloatingFiltersHeight(heightInPx) Sets the height for the row containing the floating filters.
setPivotHeaderHeight(heightInPx) Sets the height for the row containing the columns when in pivot mode.
setPivotGroupHeaderHeight(heightInPx) Sets the height for the row containing header column groups when in pivot mode.

Status Bar

getStatusBarComponent(key) Returns the status bar component instance for key provided.


getChartModels() Returns a list of models with information about the charts that are currently rendered from the grid.
createRangeChart(params) Used to programmatically create charts from a range. See Range Chart API.
createPivotChart(params) Used to programmatically create pivot charts from a grid. See Pivot Chart API.


setPopupParent(element) DOM element to use as popup parent for grid popups (context menu, column menu etc).
addRenderedRowListener(event, rowIndex, callback) Registers a callback to a virtual row. A virtual row is a row that is visually rendered on the screen (rows that are not visible because of the scroll position are not rendered). Unlike normal events, you do not need to unregister rendered row listeners. When the rendered row is removed from the grid, all associated rendered row listeners will also be removed. Currently only one event: 'virtualRowRemoved' - listen for this event if your cellRenderer needs to do clean down after the row no longer exists.
showToolPanel(show) Shows (or hides) the tool panel.
isToolPanelShowing() Returns true if the tool panel is showing, otherwise false.
getToolPanelInstance(id) Gets the tool panel instance corresponding to the supplied id. See Expand / Collpase Column Groups.
doLayout() Force the grid to lay out its components. The grid, by default, resizes to fit the div the grid lives in. This is done a) on initialisation b) window resize and c) every 500ms. You should call this if something happens in your application where the grid size has changed and you want to lay the grid out without waiting for the next 500ms refresh.
getValue(colKey, node) Gets the value for a column for a particular rowNode (row). This is useful if you want the raw value of a cell eg implementing your own csv export.
destroy() Gets the grid to destroy and release resources. If you are using Angular (version 1 or 2) you do not need to call this, as the grid links in with the AngularJS 1.x lifecycle. However if you are using Web Components or native Javascript, you do need to call this, to avoid a memory leak in your application.
showColumnMenuAfterButtonClick(colKey, buttonElement), showColumnMenuAfterMouseClick(colKey, mouseEvent) Shows the column menu after and positions it relative to the provided element (button click) or mouse event. Use in conjunction with your own header template.
checkGridSize() Gets the grid to check its size again. This is useful if you do not have the grid in the DOM when you create it, call this method after the grid is in the dom to get it to check its width and height again (which decides what columns and rows to render).
resetRowHeights() Gets the grid to recalculated the row heights.
onRowHeightChanged() Tells the grid a row height has changed. To be used after calling rowNode.setRowHeight(newHeight).
copySelectedRowsToClipboard(includeHeaders, columnKeys) Copies the selected rows to the clipboard. Set includeHeaders = true to include the headers (default is false) set columnKeys to the list of columns if you don't want just specific columns.
addAggFunc(key, aggFunc), addAggFuncs(aggFuncs), clearAggFuncs() Adding and clearing of aggregation functions.
hidePopupMenu() Hides any showing context menu or column menu.
setSuppressRowDrag(value) Sets the suppressRowDrag property.
setEnableCellTextSelection() Sets the enableCellTextSelection property.
setGridAutoHeight(value) Sets the gridAutoHeight property.
isAnimationFrameQueueEmpty() Returns true when there are no more animation frames left to process.
purgeServerSideCache(route) Purges the server-Side cache. If you pass no parameters, then the top level cache is purged. To purge a child cache, then pass in the string of keys to get to the child cache. For more details see: Purging Groups.