Core Features

Advanced Features

React Data GridColumns Tool Panel - Deferred Updates

Version 36.3.0
Enterprise

Add Apply, Cancel and Reset buttons to the Columns Tool Panel, and stage changes until the user applies them.

Deferred Updates Copy Link

Deferred Updates stage changes made in the Columns Tool Panel until the user clicks Apply. Users can make several configuration changes and apply them in a single update, avoiding intermediate recomputations or server requests.

The example below demonstrates Deferred Updates. Note the following:

  • Changes made in the Columns Tool Panel are staged as pending changes.
  • Apply commits all pending changes in a single operation.
  • Cancel discards all pending changes and restores the last applied state.
  • Reset immediately restores the columns to the state defined in the current column definitions and discards all pending changes.

Include 'apply' in toolPanelParams.buttons to enable Deferred Updates:

const sideBar = useMemo(() => { 
	return {
        toolPanels: [
            {
                id: 'columns',
                labelDefault: 'Columns',
                labelKey: 'columns',
                iconKey: 'columns',
                toolPanel: 'agColumnsToolPanel',
                toolPanelParams: {
                    buttons: ['cancel', 'apply'],
                },
            },
        ],
        defaultToolPanel: 'columns',
    };
}, []);

<AgGridReact sideBar={sideBar} />

Changes made outside the Columns Tool Panel, such as dragging columns into the Row Group or Pivot Panels, using the Column Menu, or calling the Grid API, are applied immediately and clear any pending changes. Column pinning, resizing and group expansion do not clear pending changes.

Reset Without Deferred Updates Copy Link

The Reset button does not depend on Deferred Updates. Include 'reset' without 'apply' to add a button that resets the columns to the state defined in the current column definitions, as api.resetColumnState() does.

The example below adds only a Reset button. Note the following:

  • Changes made in the Columns Tool Panel are applied immediately, as there is no Apply button.
  • Reset restores the columns to the state defined in the current column definitions.

Server-Side Row Model Copy Link

With the Server-Side Row Model, Deferred Updates batch several configuration changes into a single server request. See Deferred Column Configuration for an example.

API Copy Link

buttonsCopy Link
ColumnToolPanelAction[]
Buttons to display at the bottom of the Columns Tool Panel, in the order they should be displayed in.
  • 'apply': Changes are deferred until the Apply button is clicked.
  • 'cancel': Discards any deferred changes. Only has an effect when 'apply' is also included.
  • 'reset': Immediately resets the columns to the state defined in the current column definitions, discarding any pending changes.
  • Only the 'apply' button enables deferred changes.