This section covers Tool Panels, available via the grid's Side Bar, which allow for easy access to powerful grid operations such as grouping, pivoting, and filtering. Custom Tool Panels can also be provided to the grid.
Overview
Tool Panels are panels that sit in the Side Bar to the right of the grid. The Side Bar allows access to the tool panels via buttons that work like tabs. The Side Bar and a Tool Panel are highlighted in the screenshot below.
The grid provides the following Tool Panels:
In addition to the provided Tool Panels, it is also possible to provide custom Tool Panels.
API
The gridApi
has the following methods that can be used to interact with the tool panel.
| Function | Opens a particular tool panel. Provide the ID of the tool panel to open. openToolPanel = (key: string) => void;
|
| Function | Closes the currently open tool panel (if any). closeToolPanel = () => void;
|
| Function | Returns the ID of the currently shown tool panel if any, otherwise null . getOpenedToolPanel = () => string | null;
|
| Function | Returns true if the tool panel is showing, otherwise false . isToolPanelShowing = () => boolean;
|
| Function | Force refresh all tool panels by calling their refresh method. refreshToolPanel = () => void;
|
| Function | Gets the tool panel instance corresponding to the supplied id . getToolPanelInstance = (id: string) => TToolPanel | undefined;
|
Events
The following events are emitted from the tool panel.
| ToolPanelVisibleChangedEvent | The tool panel was hidden or shown. Use api.isToolPanelShowing() to get status. onToolPanelVisibleChanged = (
event: ToolPanelVisibleChangedEvent<TData>
) => void;
interface ToolPanelVisibleChangedEvent<TData = any, TContext = any> {
source: string | undefined;
// The grid api.
api: GridApi<TData>;
// The column api.
columnApi: ColumnApi;
// Application context as set on `gridOptions.context`.
context: TContext;
// Event identifier
type: string;
}
|
| ToolPanelSizeChangedEvent | The tool panel size has been changed. onToolPanelSizeChanged = (
event: ToolPanelSizeChangedEvent<TData>
) => void;
interface ToolPanelSizeChangedEvent<TData = any, TContext = any> {
// Event identifier
type: 'toolPanelSizeChanged';
// True if this is the first change to the Tool Panel size.
started: boolean;
// True if this is the last change to the Tool Panel size.
ended: boolean;
// New width of the ToolPanel component.
width: number;
// The grid api.
api: GridApi<TData>;
// The column api.
columnApi: ColumnApi;
// Application context as set on `gridOptions.context`.
context: TContext;
}
|
Next Up
Before covering the Tool Panels in detail, continue to the next section to learn about the Side Bar.