UNPKG

45.8 kBTypeScriptView Raw
1import { AlignedGridsService } from "./alignedGridsService";
2import { ColumnApi } from "./columns/columnApi";
3import { ISizeColumnsToFitParams } from "./columns/columnModel";
4import { Context } from "./context/context";
5import { CellPosition } from "./entities/cellPositionUtils";
6import { ColDef, ColGroupDef, IAggFunc } from "./entities/colDef";
7import { Column } from "./entities/column";
8import { ChartRef, DomLayoutType, GetChartToolbarItems, GetContextMenuItems, GetMainMenuItems, GetRowIdFunc, GetRowNodeIdFunc, GetServerSideGroupKey, GridOptions, IsApplyServerSideTransaction, IsRowMaster, IsRowSelectable, IsServerSideGroup, RowClassParams, RowGroupingDisplayType, ServerSideGroupLevelParams } from "./entities/gridOptions";
9import { GetGroupRowAggParams, GetServerSideGroupLevelParamsParams, InitialGroupOrderComparatorParams, IsFullWidthRowParams, IsServerSideGroupOpenByDefaultParams, NavigateToNextCellParams, NavigateToNextHeaderParams, PaginationNumberFormatterParams, PostProcessPopupParams, PostSortRowsParams, ProcessRowParams, RowHeightParams, TabToNextCellParams, TabToNextHeaderParams } from "./interfaces/iCallbackParams";
10import { RowPinnedType, IRowNode } from "./interfaces/iRowNode";
11import { AgEvent, ColumnEventType, SelectionEventSourceType } from "./events";
12import { RowDropZoneEvents, RowDropZoneParams } from "./gridBodyComp/rowDragFeature";
13import { HeaderPosition } from "./headerRendering/common/headerPosition";
14import { CsvExportParams, ProcessCellForExportParams } from "./interfaces/exportParams";
15import { ICellEditor } from "./interfaces/iCellEditor";
16import { ChartDownloadParams, ChartModel, CloseChartToolPanelParams, GetChartImageDataUrlParams, OpenChartToolPanelParams, CreateCrossFilterChartParams, CreatePivotChartParams, CreateRangeChartParams } from './interfaces/IChartService';
17import { ClientSideRowModelStep } from "./interfaces/iClientSideRowModel";
18import { IClipboardCopyParams, IClipboardCopyRowsParams } from "./interfaces/iClipboardService";
19import { IColumnToolPanel } from "./interfaces/iColumnToolPanel";
20import { IDatasource } from "./interfaces/iDatasource";
21import { ExcelExportMultipleSheetParams, ExcelExportParams } from "./interfaces/iExcelCreator";
22import { IFilter } from "./interfaces/iFilter";
23import { IFiltersToolPanel } from "./interfaces/iFiltersToolPanel";
24import { CellRange, CellRangeParams } from "./interfaces/IRangeService";
25import { IRowModel } from "./interfaces/iRowModel";
26import { IServerSideDatasource } from "./interfaces/iServerSideDatasource";
27import { RefreshServerSideParams } from "./interfaces/iServerSideRowModel";
28import { ServerSideGroupLevelState } from "./interfaces/IServerSideStore";
29import { ISideBar, SideBarDef } from "./interfaces/iSideBar";
30import { IStatusPanel } from "./interfaces/iStatusPanel";
31import { IToolPanel } from "./interfaces/iToolPanel";
32import { IViewportDatasource } from "./interfaces/iViewportDatasource";
33import { RowDataTransaction } from "./interfaces/rowDataTransaction";
34import { RowNodeTransaction } from "./interfaces/rowNodeTransaction";
35import { ServerSideTransaction, ServerSideTransactionResult } from "./interfaces/serverSideTransaction";
36import { ICellRenderer } from "./rendering/cellRenderers/iCellRenderer";
37import { OverlayWrapperComponent } from "./rendering/overlays/overlayWrapperComponent";
38import { FlashCellsParams, GetCellEditorInstancesParams, GetCellRendererInstancesParams, RedrawRowsParams, RefreshCellsParams } from "./rendering/rowRenderer";
39import { IServerSideGroupSelectionState, IServerSideSelectionState } from "./interfaces/iServerSideSelection";
40export interface DetailGridInfo {
41 /**
42 * Id of the detail grid, the format is `detail_<ROW_ID>`,
43 * where ROW_ID is the `id` of the parent row.
44 */
45 id: string;
46 /** Grid api of the detail grid. */
47 api?: GridApi;
48 /** Column api of the detail grid. */
49 columnApi?: ColumnApi;
50}
51export interface StartEditingCellParams {
52 /** The row index of the row to start editing */
53 rowIndex: number;
54 /** The column key of the row to start editing */
55 colKey: string | Column;
56 /** Set to `'top'` or `'bottom'` to start editing a pinned row */
57 rowPinned?: RowPinnedType;
58 /** The key to pass to the cell editor */
59 key?: string;
60 /** The charPress to pass to the cell editor */
61 charPress?: string;
62}
63export declare function unwrapUserComp<T>(comp: T): T;
64export declare class GridApi<TData = any> {
65 private immutableService;
66 private csvCreator;
67 private excelCreator;
68 private rowRenderer;
69 private navigationService;
70 private filterManager;
71 private columnModel;
72 private selectionService;
73 private gridOptionsService;
74 private valueService;
75 private alignedGridsService;
76 private eventService;
77 private pinnedRowModel;
78 private context;
79 private rowModel;
80 private sortController;
81 private paginationProxy;
82 private focusService;
83 private dragAndDropService;
84 private rangeService;
85 private clipboardService;
86 private aggFuncService;
87 private menuFactory;
88 private contextMenuFactory;
89 private valueCache;
90 private animationFrameService;
91 private statusBarService;
92 private chartService;
93 private undoRedoService;
94 private rowNodeBlockLoader;
95 private serverSideTransactionManager;
96 private ctrlsService;
97 private overlayWrapperComp;
98 private gridBodyCtrl;
99 private sideBarComp;
100 private clientSideRowModel;
101 private infiniteRowModel;
102 private serverSideRowModel;
103 private detailGridInfoMap;
104 private destroyCalled;
105 registerOverlayWrapperComp(overlayWrapperComp: OverlayWrapperComponent): void;
106 registerSideBarComp(sideBarComp: ISideBar): void;
107 private init;
108 /** Used internally by grid. Not intended to be used by the client. Interface may change between releases. */
109 __getAlignedGridService(): AlignedGridsService;
110 /** Used internally by grid. Not intended to be used by the client. Interface may change between releases. */
111 __getContext(): Context;
112 private getSetterMethod;
113 /** Used internally by grid. Not intended to be used by the client. Interface may change between releases. */
114 __setProperty<K extends keyof GridOptions>(propertyName: K, value: GridOptions[K]): void;
115 /** Register a detail grid with the master grid when it is created. */
116 addDetailGridInfo(id: string, gridInfo: DetailGridInfo): void;
117 /** Unregister a detail grid from the master grid when it is destroyed. */
118 removeDetailGridInfo(id: string): void;
119 /** Returns the `DetailGridInfo` corresponding to the supplied `detailGridId`. */
120 getDetailGridInfo(id: string): DetailGridInfo | undefined;
121 /** Iterates through each `DetailGridInfo` in the grid and calls the supplied callback on each. */
122 forEachDetailGridInfo(callback: (gridInfo: DetailGridInfo, index: number) => void): void;
123 /** Similar to `exportDataAsCsv`, except returns the result as a string rather than download it. */
124 getDataAsCsv(params?: CsvExportParams): string | undefined;
125 /** Downloads a CSV export of the grid's data. */
126 exportDataAsCsv(params?: CsvExportParams): void;
127 private getExcelExportMode;
128 private assertNotExcelMultiSheet;
129 /** Similar to `exportDataAsExcel`, except instead of downloading a file, it will return a [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) to be processed by the user. */
130 getDataAsExcel(params?: ExcelExportParams): string | Blob | undefined;
131 /** Downloads an Excel export of the grid's data. */
132 exportDataAsExcel(params?: ExcelExportParams): void;
133 /** This is method to be used to get the grid's data as a sheet, that will later be exported either by `getMultipleSheetsAsExcel()` or `exportMultipleSheetsAsExcel()`. */
134 getSheetDataForExcel(params?: ExcelExportParams): string | undefined;
135 /** Similar to `exportMultipleSheetsAsExcel`, except instead of downloading a file, it will return a [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) to be processed by the user. */
136 getMultipleSheetsAsExcel(params: ExcelExportMultipleSheetParams): Blob | undefined;
137 /** Downloads an Excel export of multiple sheets in one file. */
138 exportMultipleSheetsAsExcel(params: ExcelExportMultipleSheetParams): void;
139 /**
140 * Sets an ARIA property in the grid panel (element with `role=\"grid\"`), and removes an ARIA property when the value is null.
141 *
142 * Example: `api.setGridAriaProperty('label', 'my grid')` will set `aria-label=\"my grid\"`.
143 *
144 * `api.setGridAriaProperty('label', null)` will remove the `aria-label` attribute from the grid element.
145 */
146 setGridAriaProperty(property: string, value: string | null): void;
147 private logMissingRowModel;
148 /** Set new datasource for Server-Side Row Model. */
149 setServerSideDatasource(datasource: IServerSideDatasource): void;
150 /**
151 * Updates the `cacheBlockSize` when requesting data from the server if `suppressServerSideInfiniteScroll` is not enabled.
152 *
153 * Note this purges all the cached data and reloads all the rows of the grid.
154 * */
155 setCacheBlockSize(blockSize: number): void;
156 /** Set new datasource for Infinite Row Model. */
157 setDatasource(datasource: IDatasource): void;
158 /** Set new datasource for Viewport Row Model. */
159 setViewportDatasource(viewportDatasource: IViewportDatasource): void;
160 /** Set the row data. */
161 setRowData(rowData: TData[]): void;
162 /** Set the top pinned rows. Call with no rows / undefined to clear top pinned rows. */
163 setPinnedTopRowData(rows?: any[]): void;
164 /** Set the bottom pinned rows. Call with no rows / undefined to clear bottom pinned rows. */
165 setPinnedBottomRowData(rows?: any[]): void;
166 /** Gets the number of top pinned rows. */
167 getPinnedTopRowCount(): number;
168 /** Gets the number of bottom pinned rows. */
169 getPinnedBottomRowCount(): number;
170 /** Gets the top pinned row with the specified index. */
171 getPinnedTopRow(index: number): IRowNode | undefined;
172 /** Gets the top pinned row with the specified index. */
173 getPinnedBottomRow(index: number): IRowNode | undefined;
174 /**
175 * Call to set new column definitions. The grid will redraw all the column headers, and then redraw all of the rows.
176 */
177 setColumnDefs(colDefs: (ColDef<TData> | ColGroupDef<TData>)[], source?: ColumnEventType): void;
178 /** Call to set new auto group column definition. The grid will recreate any auto-group columns if present. */
179 setAutoGroupColumnDef(colDef: ColDef<TData>, source?: ColumnEventType): void;
180 /** Call to set new Default Column Definition. */
181 setDefaultColDef(colDef: ColDef<TData>, source?: ColumnEventType): void;
182 /** Call to set new Column Types. */
183 setColumnTypes(columnTypes: {
184 string: ColDef<TData>;
185 }, source?: ColumnEventType): void;
186 expireValueCache(): void;
187 /**
188 * Returns an object with two properties:
189 * - `top`: The top pixel position of the current scroll in the grid
190 * - `bottom`: The bottom pixel position of the current scroll in the grid
191 */
192 getVerticalPixelRange(): {
193 top: number;
194 bottom: number;
195 };
196 /**
197 * Returns an object with two properties:
198 * - `left`: The left pixel position of the current scroll in the grid
199 * - `right`: The right pixel position of the current scroll in the grid
200 */
201 getHorizontalPixelRange(): {
202 left: number;
203 right: number;
204 };
205 /** If `true`, the horizontal scrollbar will always be present, even if not required. Otherwise, it will only be displayed when necessary. */
206 setAlwaysShowHorizontalScroll(show: boolean): void;
207 /** If `true`, the vertical scrollbar will always be present, even if not required. Otherwise it will only be displayed when necessary. */
208 setAlwaysShowVerticalScroll(show: boolean): void;
209 /** Performs change detection on all cells, refreshing cells where required. */
210 refreshCells(params?: RefreshCellsParams<TData>): void;
211 /** Flash rows, columns or individual cells. */
212 flashCells(params?: FlashCellsParams<TData>): void;
213 /** Remove row(s) from the DOM and recreate them again from scratch. */
214 redrawRows(params?: RedrawRowsParams<TData>): void;
215 setFunctionsReadOnly(readOnly: boolean): void;
216 /** Redraws the header. Useful if a column name changes, or something else that changes how the column header is displayed. */
217 refreshHeader(): void;
218 /** Returns `true` if any filter is set. This includes quick filter, advanced filter or external filter. */
219 isAnyFilterPresent(): boolean;
220 /** Returns `true` if any column filter is set, otherwise `false`. */
221 isColumnFilterPresent(): boolean;
222 /** Returns `true` if the Quick Filter is set, otherwise `false`. */
223 isQuickFilterPresent(): boolean;
224 /**
225 * Returns the row model inside the table.
226 * From here you can see the original rows, rows after filter has been applied,
227 * rows after aggregation has been applied, and the final set of 'to be displayed' rows.
228 */
229 getModel(): IRowModel;
230 /** Expand or collapse a specific row node, optionally expanding/collapsing all of its parent nodes. */
231 setRowNodeExpanded(rowNode: IRowNode, expanded: boolean, expandParents?: boolean): void;
232 /**
233 * Informs the grid that row group expanded state has changed and it needs to rerender the group nodes.
234 * Typically called after updating the row node expanded state explicitly, i.e `rowNode.expanded = false`,
235 * across multiple groups and you want to update the grid view in a single rerender instead of on every group change.
236 */
237 onGroupExpandedOrCollapsed(): void;
238 /**
239 * Refresh the Client-Side Row Model, executing the grouping, filtering and sorting again.
240 * Optionally provide the step you wish the refresh to apply from. Defaults to `everything`.
241 */
242 refreshClientSideRowModel(step?: ClientSideRowModelStep): any;
243 /** Returns `true` when there are no more animation frames left to process. */
244 isAnimationFrameQueueEmpty(): boolean;
245 flushAllAnimationFrames(): void;
246 /**
247 * Returns the row node with the given ID.
248 * The row node ID is the one you provide from the callback `getRowId(params)`,
249 * otherwise the ID is a number (cast as string) auto-generated by the grid when
250 * the row data is set.
251 */
252 getRowNode(id: string): IRowNode<TData> | undefined;
253 /**
254 * Gets the sizes that various UI elements will be rendered at with the current theme.
255 * If you override the row or header height using `gridOptions`, the override value you provided will be returned.
256 */
257 getSizesForCurrentTheme(): {
258 rowHeight: number;
259 headerHeight: number;
260 };
261 /** Expand all groups. */
262 expandAll(): void;
263 /** Collapse all groups. */
264 collapseAll(): void;
265 /**
266 * Registers a callback to a virtual row.
267 * 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).
268 * Unlike normal events, you do not need to unregister rendered row listeners.
269 * When the rendered row is removed from the grid, all associated rendered row listeners will also be removed.
270 * listen for this event if your `cellRenderer` needs to do cleanup when the row no longer exists.
271 */
272 addRenderedRowListener(eventName: string, rowIndex: number, callback: Function): void;
273 /** Get the current Quick Filter text from the grid, or `undefined` if none is set. */
274 getQuickFilter(): string | undefined;
275 /** Pass a Quick Filter text into the grid for filtering. */
276 setQuickFilter(newFilter: string): void;
277 /**
278 * Updates the `excludeHiddenColumnsFromQuickFilter` grid option.
279 * Set to `true` to exclude hidden columns from being checked by the Quick Filter (or `false` to include them).
280 * This can give a significant performance improvement when there are a large number of hidden columns,
281 * and you are only interested in filtering on what's visible.
282 */
283 setExcludeHiddenColumnsFromQuickFilter(value: boolean): void;
284 /**
285 * Select all rows, regardless of filtering and rows that are not visible due to grouping being enabled and their groups not expanded.
286 * @param source Source property that will appear in the `selectionChanged` event. Default: `'apiSelectAll'`
287 */
288 selectAll(source?: SelectionEventSourceType): void;
289 /**
290 * Clear all row selections, regardless of filtering.
291 * @param source Source property that will appear in the `selectionChanged` event. Default: `'apiSelectAll'`
292 */
293 deselectAll(source?: SelectionEventSourceType): void;
294 /**
295 * Select all filtered rows.
296 * @param source Source property that will appear in the `selectionChanged` event. Default: `'apiSelectAllFiltered'`
297 */
298 selectAllFiltered(source?: SelectionEventSourceType): void;
299 /**
300 * Clear all filtered selections.
301 * @param source Source property that will appear in the `selectionChanged` event. Default: `'apiSelectAllFiltered'`
302 */
303 deselectAllFiltered(source?: SelectionEventSourceType): void;
304 /**
305 * Returns an object containing rules matching the selected rows in the SSRM.
306 *
307 * If `groupSelectsChildren=false` the returned object will be flat, and will conform to IServerSideSelectionState.
308 * If `groupSelectsChildren=true` the retuned object will be hierarchical, and will conform to IServerSideGroupSelectionState.
309 */
310 getServerSideSelectionState(): IServerSideSelectionState | IServerSideGroupSelectionState | null;
311 /**
312 * Set the rules matching the selected rows in the SSRM.
313 *
314 * If `groupSelectsChildren=false` the param will be flat, and should conform to IServerSideSelectionState.
315 * If `groupSelectsChildren=true` the param will be hierarchical, and should conform to IServerSideGroupSelectionState.
316 */
317 setServerSideSelectionState(state: IServerSideSelectionState | IServerSideGroupSelectionState): void;
318 /**
319 * Select all rows on the current page.
320 * @param source Source property that will appear in the `selectionChanged` event. Default: `'apiSelectAllCurrentPage'`
321 */
322 selectAllOnCurrentPage(source?: SelectionEventSourceType): void;
323 /**
324 * Clear all filtered on the current page.
325 * @param source Source property that will appear in the `selectionChanged` event. Default: `'apiSelectAllCurrentPage'`
326 */
327 deselectAllOnCurrentPage(source?: SelectionEventSourceType): void;
328 /**
329 * Sets columns to adjust in size to fit the grid horizontally.
330 **/
331 sizeColumnsToFit(params?: ISizeColumnsToFitParams): void;
332 /** Show the 'loading' overlay. */
333 showLoadingOverlay(): void;
334 /** Show the 'no rows' overlay. */
335 showNoRowsOverlay(): void;
336 /** Hides the overlay if showing. */
337 hideOverlay(): void;
338 /**
339 * Returns an unsorted list of selected nodes.
340 * Getting the underlying node (rather than the data) is useful when working with tree / aggregated data,
341 * as the node can be traversed.
342 */
343 getSelectedNodes(): IRowNode<TData>[];
344 /** Returns an unsorted list of selected rows (i.e. row data that you provided). */
345 getSelectedRows(): TData[];
346 /**
347 * Returns a list of all selected nodes at 'best cost', a feature to be used with groups / trees.
348 * If a group has all its children selected, then the group appears in the result, but not the children.
349 * Designed for use with `'children'` as the group selection type, where groups don't actually appear in the selection normally.
350 */
351 getBestCostNodeSelection(): IRowNode<TData>[] | undefined;
352 /** Retrieve rendered nodes. Due to virtualisation this will contain only the current visible rows and those in the buffer. */
353 getRenderedNodes(): IRowNode<TData>[];
354 /**
355 * Ensures the column is visible by scrolling the table if needed.
356 *
357 * This will have no effect before the firstDataRendered event has fired.
358 *
359 * @param key - The column to ensure visible
360 * @param position - Where the column will be positioned.
361 * - `auto` - Scrolls the minimum amount to make sure the column is visible.
362 * - `start` - Scrolls the column to the start of the viewport.
363 * - `middle` - Scrolls the column to the middle of the viewport.
364 * - `end` - Scrolls the column to the end of the viewport.
365 */
366 ensureColumnVisible(key: string | Column, position?: 'auto' | 'start' | 'middle' | 'end'): void;
367 /**
368 * Vertically scrolls the grid until the provided row index is inside the visible viewport.
369 * If a position is provided, the grid will attempt to scroll until the row is at the given position within the viewport.
370 * This will have no effect before the firstDataRendered event has fired.
371 */
372 ensureIndexVisible(index: number, position?: 'top' | 'bottom' | 'middle' | null): void;
373 /**
374 * Vertically scrolls the grid until the provided row (or a row matching the provided comparator) is inside the visible viewport.
375 * If a position is provided, the grid will attempt to scroll until the row is at the given position within the viewport.
376 * This will have no effect before the firstDataRendered event has fired.
377 */
378 ensureNodeVisible(nodeSelector: TData | IRowNode<TData> | ((row: IRowNode<TData>) => boolean), position?: 'top' | 'bottom' | 'middle' | null): void;
379 /**
380 * Similar to `forEachNode`, except lists all the leaf nodes.
381 * This effectively goes through all the data that you provided to the grid before the grid performed any grouping.
382 * If using tree data, goes through all the nodes for the data you provided, including nodes that have children,
383 * but excluding groups the grid created where gaps were missing in the hierarchy.
384 */
385 forEachLeafNode(callback: (rowNode: IRowNode<TData>) => void): void;
386 /**
387 * Iterates through each node (row) in the grid and calls the callback for each node.
388 * This works similar to the `forEach` method on a JavaScript array.
389 * This is called for every node, ignoring any filtering or sorting applied within the grid.
390 * If using the Infinite Row Model, then this gets called for each page loaded in the page cache.
391 */
392 forEachNode(callback: (rowNode: IRowNode<TData>, index: number) => void, includeFooterNodes?: boolean): void;
393 /** Similar to `forEachNode`, except skips any filtered out data. */
394 forEachNodeAfterFilter(callback: (rowNode: IRowNode<TData>, index: number) => void): void;
395 /** Similar to `forEachNodeAfterFilter`, except the callbacks are called in the order the rows are displayed in the grid. */
396 forEachNodeAfterFilterAndSort(callback: (rowNode: IRowNode<TData>, index: number) => void): void;
397 /**
398 * Returns the filter component instance for a column.
399 * `key` can be a string field name or a ColDef object (matches on object reference, useful if field names are not unique).
400 * If your filter is created asynchronously, `getFilterInstance` will return `null` so you will need to use the `callback` to access the filter instance instead.
401 */
402 getFilterInstance<TFilter extends IFilter>(key: string | Column, callback?: (filter: TFilter | null) => void): TFilter | null | undefined;
403 private getFilterInstanceImpl;
404 /** Destroys a filter. Useful to force a particular filter to be created from scratch again. */
405 destroyFilter(key: string | Column): void;
406 /** Gets the status panel instance corresponding to the supplied `id`. */
407 getStatusPanel<TStatusPanel = IStatusPanel>(key: string): TStatusPanel | undefined;
408 getColumnDef(key: string | Column): ColDef<TData> | null;
409 /**
410 * Returns the current column definitions.
411 */
412 getColumnDefs(): (ColDef<TData> | ColGroupDef<TData>)[] | undefined;
413 /** Informs the grid that a filter has changed. This is typically called after a filter change through one of the filter APIs. */
414 onFilterChanged(): void;
415 /**
416 * Gets the grid to act as if the sort was changed.
417 * Useful if you update some values and want to get the grid to reorder them according to the new values.
418 */
419 onSortChanged(): void;
420 /** Sets the state of all the advanced filters. Provide it with what you get from `getFilterModel()` to restore filter state. */
421 setFilterModel(model: any): void;
422 /** Gets the current state of all the advanced filters. Used for saving filter state. */
423 getFilterModel(): {
424 [key: string]: any;
425 };
426 /** Returns the focused cell (or the last focused cell if the grid lost focus). */
427 getFocusedCell(): CellPosition | null;
428 /** Clears the focused cell. */
429 clearFocusedCell(): void;
430 /** Sets the focus to the specified cell. `rowPinned` can be either 'top', 'bottom' or null (for not pinned). */
431 setFocusedCell(rowIndex: number, colKey: string | Column, rowPinned?: RowPinnedType): void;
432 /** Sets the `suppressRowDrag` property. */
433 setSuppressRowDrag(value: boolean): void;
434 /** Sets the `suppressMoveWhenRowDragging` property. */
435 setSuppressMoveWhenRowDragging(value: boolean): void;
436 /** Sets the `suppressRowClickSelection` property. */
437 setSuppressRowClickSelection(value: boolean): void;
438 /** Adds a drop zone outside of the grid where rows can be dropped. */
439 addRowDropZone(params: RowDropZoneParams): void;
440 /** Removes an external drop zone added by `addRowDropZone`. */
441 removeRowDropZone(params: RowDropZoneParams): void;
442 /** Returns the `RowDropZoneParams` to be used by another grid's `addRowDropZone` method. */
443 getRowDropZoneParams(events?: RowDropZoneEvents): RowDropZoneParams;
444 /** Sets the height in pixels for the row containing the column label header. */
445 setHeaderHeight(headerHeight?: number): void;
446 /**
447 * Switch between layout options: `normal`, `autoHeight`, `print`.
448 * Defaults to `normal` if no domLayout provided.
449 */
450 setDomLayout(domLayout?: DomLayoutType): void;
451 /** Sets the `enableCellTextSelection` property. */
452 setEnableCellTextSelection(selectable: boolean): void;
453 /** Sets the preferred direction for the selection fill handle. */
454 setFillHandleDirection(direction: 'x' | 'y' | 'xy'): void;
455 /** Sets the height in pixels for the rows containing header column groups. */
456 setGroupHeaderHeight(headerHeight?: number): void;
457 /** Sets the height in pixels for the row containing the floating filters. */
458 setFloatingFiltersHeight(headerHeight?: number): void;
459 /** Sets the height in pixels for the row containing the columns when in pivot mode. */
460 setPivotHeaderHeight(headerHeight?: number): void;
461 /** Sets the height in pixels for the row containing header column groups when in pivot mode. */
462 setPivotGroupHeaderHeight(headerHeight?: number): void;
463 setPivotMode(pivotMode: boolean): void;
464 setAnimateRows(animateRows: boolean): void;
465 setIsExternalFilterPresent(isExternalFilterPresentFunc: () => boolean): void;
466 setDoesExternalFilterPass(doesExternalFilterPassFunc: (node: IRowNode) => boolean): void;
467 setNavigateToNextCell(navigateToNextCellFunc: (params: NavigateToNextCellParams) => (CellPosition | null)): void;
468 setTabToNextCell(tabToNextCellFunc: (params: TabToNextCellParams) => (CellPosition | null)): void;
469 setTabToNextHeader(tabToNextHeaderFunc: (params: TabToNextHeaderParams) => (HeaderPosition | null)): void;
470 setNavigateToNextHeader(navigateToNextHeaderFunc: (params: NavigateToNextHeaderParams) => (HeaderPosition | null)): void;
471 setRowGroupPanelShow(rowGroupPanelShow: 'always' | 'onlyWhenGrouping' | 'never'): void;
472 /** @deprecated v27.2 - Use `setGetGroupRowAgg` instead. */
473 setGroupRowAggNodes(groupRowAggNodesFunc: (nodes: IRowNode[]) => any): void;
474 setGetGroupRowAgg(getGroupRowAggFunc: (params: GetGroupRowAggParams) => any): void;
475 setGetBusinessKeyForNode(getBusinessKeyForNodeFunc: (nodes: IRowNode) => string): void;
476 setGetChildCount(getChildCountFunc: (dataItem: any) => number): void;
477 setProcessRowPostCreate(processRowPostCreateFunc: (params: ProcessRowParams) => void): void;
478 /** @deprecated v27.1 Use `setGetRowId` instead */
479 setGetRowNodeId(getRowNodeIdFunc: GetRowNodeIdFunc): void;
480 setGetRowId(getRowIdFunc: GetRowIdFunc): void;
481 setGetRowClass(rowClassFunc: (params: RowClassParams) => string | string[]): void;
482 /** @deprecated v27.2 Use `setIsFullWidthRow` instead. */
483 setIsFullWidthCell(isFullWidthCellFunc: (rowNode: IRowNode) => boolean): void;
484 setIsFullWidthRow(isFullWidthRowFunc: (params: IsFullWidthRowParams) => boolean): void;
485 setIsRowSelectable(isRowSelectableFunc: IsRowSelectable): void;
486 setIsRowMaster(isRowMasterFunc: IsRowMaster): void;
487 /** @deprecated v27.2 Use `setPostSortRows` instead */
488 setPostSort(postSortFunc: (nodes: IRowNode[]) => void): void;
489 setPostSortRows(postSortRowsFunc: (params: PostSortRowsParams) => void): void;
490 setGetDocument(getDocumentFunc: () => Document): void;
491 setGetContextMenuItems(getContextMenuItemsFunc: GetContextMenuItems): void;
492 setGetMainMenuItems(getMainMenuItemsFunc: GetMainMenuItems): void;
493 setProcessCellForClipboard(processCellForClipboardFunc: (params: ProcessCellForExportParams) => any): void;
494 setSendToClipboard(sendToClipboardFunc: (params: {
495 data: string;
496 }) => void): void;
497 setProcessCellFromClipboard(processCellFromClipboardFunc: (params: ProcessCellForExportParams) => any): void;
498 /** @deprecated v28 use `setProcessPivotResultColDef` instead */
499 setProcessSecondaryColDef(processSecondaryColDefFunc: (colDef: ColDef) => void): void;
500 /** @deprecated v28 use `setProcessPivotResultColGroupDef` instead */
501 setProcessSecondaryColGroupDef(processSecondaryColGroupDefFunc: (colDef: ColDef) => void): void;
502 setProcessPivotResultColDef(processPivotResultColDefFunc: (colDef: ColDef) => void): void;
503 setProcessPivotResultColGroupDef(processPivotResultColGroupDefFunc: (colDef: ColDef) => void): void;
504 setPostProcessPopup(postProcessPopupFunc: (params: PostProcessPopupParams) => void): void;
505 /** @deprecated v27.2 - Use `setInitialGroupOrderComparator` instead */
506 setDefaultGroupOrderComparator(defaultGroupOrderComparatorFunc: (nodeA: IRowNode, nodeB: IRowNode) => number): void;
507 setInitialGroupOrderComparator(initialGroupOrderComparatorFunc: (params: InitialGroupOrderComparatorParams) => number): void;
508 setGetChartToolbarItems(getChartToolbarItemsFunc: GetChartToolbarItems): void;
509 setPaginationNumberFormatter(paginationNumberFormatterFunc: (params: PaginationNumberFormatterParams) => string): void;
510 /** @deprecated v28 use setGetServerSideGroupLevelParams instead */
511 setGetServerSideStoreParams(getServerSideStoreParamsFunc: (params: GetServerSideGroupLevelParamsParams) => ServerSideGroupLevelParams): void;
512 setGetServerSideGroupLevelParams(getServerSideGroupLevelParamsFunc: (params: GetServerSideGroupLevelParamsParams) => ServerSideGroupLevelParams): void;
513 setIsServerSideGroupOpenByDefault(isServerSideGroupOpenByDefaultFunc: (params: IsServerSideGroupOpenByDefaultParams) => boolean): void;
514 setIsApplyServerSideTransaction(isApplyServerSideTransactionFunc: IsApplyServerSideTransaction): void;
515 setIsServerSideGroup(isServerSideGroupFunc: IsServerSideGroup): void;
516 setGetServerSideGroupKey(getServerSideGroupKeyFunc: GetServerSideGroupKey): void;
517 setGetRowStyle(rowStyleFunc: (params: RowClassParams) => {}): void;
518 setGetRowHeight(rowHeightFunc: (params: RowHeightParams) => number): void;
519 private assertSideBarLoaded;
520 /** Returns `true` if the side bar is visible. */
521 isSideBarVisible(): boolean;
522 /** Show/hide the entire side bar, including any visible panel and the tab buttons. */
523 setSideBarVisible(show: boolean): void;
524 /** Sets the side bar position relative to the grid. Possible values are `'left'` or `'right'`. */
525 setSideBarPosition(position: 'left' | 'right'): void;
526 /** Opens a particular tool panel. Provide the ID of the tool panel to open. */
527 openToolPanel(key: string): void;
528 /** Closes the currently open tool panel (if any). */
529 closeToolPanel(): void;
530 /** Returns the ID of the currently shown tool panel if any, otherwise `null`. */
531 getOpenedToolPanel(): string | null;
532 /** Force refresh all tool panels by calling their `refresh` method. */
533 refreshToolPanel(): void;
534 /** Returns `true` if the tool panel is showing, otherwise `false`. */
535 isToolPanelShowing(): boolean;
536 getToolPanelInstance(id: 'columns'): IColumnToolPanel | undefined;
537 getToolPanelInstance(id: 'filters'): IFiltersToolPanel | undefined;
538 getToolPanelInstance<TToolPanel = IToolPanel>(id: string): TToolPanel | undefined;
539 /** Returns the current side bar configuration. If a shortcut was used, returns the detailed long form. */
540 getSideBar(): SideBarDef | undefined;
541 /** Resets the side bar to the provided configuration. The parameter is the same as the sideBar grid property. The side bar is re-created from scratch with the new config. */
542 setSideBar(def: SideBarDef | string | string[] | boolean): void;
543 setSuppressClipboardPaste(value: boolean): void;
544 /** Tells the grid to recalculate the row heights. */
545 resetRowHeights(): void;
546 setGroupRemoveSingleChildren(value: boolean): void;
547 setGroupRemoveLowestSingleChildren(value: boolean): void;
548 setGroupDisplayType(value: RowGroupingDisplayType): void;
549 setRowClass(className: string | undefined): void;
550 /** Sets the `deltaSort` property */
551 setDeltaSort(enable: boolean): void;
552 /**
553 * Sets the `rowCount` and `lastRowIndexKnown` properties.
554 * The second parameter, `lastRowIndexKnown`, is optional and if left out, only `rowCount` is set.
555 * Set `rowCount` to adjust the height of the vertical scroll.
556 * Set `lastRowIndexKnown` to enable / disable searching for more rows.
557 * Use this method if you add or remove rows into the dataset and need to reset the number of rows or put the data back into 'look for data' mode.
558 */
559 setRowCount(rowCount: number, maxRowFound?: boolean): void;
560 /** Tells the grid a row height has changed. To be used after calling `rowNode.setRowHeight(newHeight)`. */
561 onRowHeightChanged(): void;
562 /**
563 * Gets the value for a column for a particular `rowNode` (row).
564 * This is useful if you want the raw value of a cell e.g. if implementing your own CSV export.
565 */
566 getValue(colKey: string | Column, rowNode: IRowNode): any;
567 /** Add an event listener for the specified `eventType`. Works similar to `addEventListener` for a browser DOM element. */
568 addEventListener(eventType: string, listener: Function): void;
569 /** Add an event listener for all event types coming from the grid. */
570 addGlobalListener(listener: Function): void;
571 /** Remove an event listener. */
572 removeEventListener(eventType: string, listener: Function): void;
573 /** Remove a global event listener. */
574 removeGlobalListener(listener: Function): void;
575 dispatchEvent(event: AgEvent): void;
576 /** Will destroy the grid and release resources. If you are using a framework you do not need to call this, as the grid links in with the framework 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. */
577 destroy(): void;
578 private cleanDownReferencesToAvoidMemoryLeakInCaseApplicationIsKeepingReferenceToDestroyedGrid;
579 private warnIfDestroyed;
580 /** Reset the Quick Filter cache text on every rowNode. */
581 resetQuickFilter(): void;
582 /** Returns the list of selected cell ranges. */
583 getCellRanges(): CellRange[] | null;
584 /** Adds the provided cell range to the selected ranges. */
585 addCellRange(params: CellRangeParams): void;
586 /** Clears the selected ranges. */
587 clearRangeSelection(): void;
588 /** Reverts the last cell edit. */
589 undoCellEditing(): void;
590 /** Re-applies the most recently undone cell edit. */
591 redoCellEditing(): void;
592 /** Returns current number of available cell edit undo operations. */
593 getCurrentUndoSize(): number;
594 /** Returns current number of available cell edit redo operations. */
595 getCurrentRedoSize(): number;
596 /** Returns a list of models with information about the charts that are currently rendered from the grid. */
597 getChartModels(): ChartModel[] | undefined;
598 /** Returns the `ChartRef` using the supplied `chartId`. */
599 getChartRef(chartId: string): ChartRef | undefined;
600 /** Returns a base64-encoded image data URL for the referenced chartId. */
601 getChartImageDataURL(params: GetChartImageDataUrlParams): string | undefined;
602 /** Starts a browser-based image download for the referenced chartId. */
603 downloadChart(params: ChartDownloadParams): void;
604 /** Open the Chart Tool Panel. */
605 openChartToolPanel(params: OpenChartToolPanelParams): void;
606 /** Close the Chart Tool Panel. */
607 closeChartToolPanel(params: CloseChartToolPanelParams): void;
608 /** Used to programmatically create charts from a range. */
609 createRangeChart(params: CreateRangeChartParams): ChartRef | undefined;
610 /** Used to programmatically create cross filter charts from a range. */
611 createCrossFilterChart(params: CreateCrossFilterChartParams): ChartRef | undefined;
612 /** Restores a chart using the `ChartModel` that was previously obtained from `getChartModels()`. */
613 restoreChart(chartModel: ChartModel, chartContainer?: HTMLElement): ChartRef | undefined;
614 /** Used to programmatically create pivot charts from a grid. */
615 createPivotChart(params: CreatePivotChartParams): ChartRef | undefined;
616 /** Copies data to clipboard by following the same rules as pressing Ctrl+C. */
617 copyToClipboard(params?: IClipboardCopyParams): void;
618 /** Cuts data to clipboard by following the same rules as pressing Ctrl+X. */
619 cutToClipboard(params?: IClipboardCopyParams): void;
620 /** Copies the selected rows to the clipboard. */
621 copySelectedRowsToClipboard(params?: IClipboardCopyRowsParams): void;
622 /** Copies the selected ranges to the clipboard. */
623 copySelectedRangeToClipboard(params?: IClipboardCopyParams): void;
624 /** Copies the selected range down, similar to `Ctrl + D` in Excel. */
625 copySelectedRangeDown(): void;
626 /** Shows the column menu after and positions it relative to the provided button element. Use in conjunction with your own header template. */
627 showColumnMenuAfterButtonClick(colKey: string | Column, buttonElement: HTMLElement): void;
628 /** Shows the column menu after and positions it relative to the mouse event. Use in conjunction with your own header template. */
629 showColumnMenuAfterMouseClick(colKey: string | Column, mouseEvent: MouseEvent | Touch): void;
630 /** Hides any visible context menu or column menu. */
631 hidePopupMenu(): void;
632 /** DOM element to use as the popup parent for grid popups (context menu, column menu etc). */
633 setPopupParent(ePopupParent: HTMLElement): void;
634 /** Navigates the grid focus to the next cell, as if tabbing. */
635 tabToNextCell(event?: KeyboardEvent): boolean;
636 /** Navigates the grid focus to the previous cell, as if shift-tabbing. */
637 tabToPreviousCell(event?: KeyboardEvent): boolean;
638 /** Returns the list of active cell renderer instances. */
639 getCellRendererInstances(params?: GetCellRendererInstancesParams<TData>): ICellRenderer[];
640 /** Returns the list of active cell editor instances. Optionally provide parameters to restrict to certain columns / row nodes. */
641 getCellEditorInstances(params?: GetCellEditorInstancesParams<TData>): ICellEditor[];
642 /** If the grid is editing, returns back details of the editing cell(s). */
643 getEditingCells(): CellPosition[];
644 /** If a cell is editing, it stops the editing. Pass `true` if you want to cancel the editing (i.e. don't accept changes). */
645 stopEditing(cancel?: boolean): void;
646 /** Start editing the provided cell. If another cell is editing, the editing will be stopped in that other cell. */
647 startEditingCell(params: StartEditingCellParams): void;
648 /** Add an aggregation function with the specified key. */
649 addAggFunc(key: string, aggFunc: IAggFunc): void;
650 /** Add aggregations function with the specified keys. */
651 addAggFuncs(aggFuncs: {
652 [key: string]: IAggFunc;
653 }): void;
654 /** Clears all aggregation functions (including those provided by the grid). */
655 clearAggFuncs(): void;
656 /** Apply transactions to the server side row model. */
657 applyServerSideTransaction(transaction: ServerSideTransaction): ServerSideTransactionResult | undefined;
658 /** Batch apply transactions to the server side row model. */
659 applyServerSideTransactionAsync(transaction: ServerSideTransaction, callback?: (res: ServerSideTransactionResult) => void): void;
660 /** Gets all failed server side loads to retry. */
661 retryServerSideLoads(): void;
662 flushServerSideAsyncTransactions(): void;
663 /** Update row data. Pass a transaction object with lists for `add`, `remove` and `update`. */
664 applyTransaction(rowDataTransaction: RowDataTransaction<TData>): RowNodeTransaction<TData> | null | undefined;
665 /** Same as `applyTransaction` except executes asynchronously for efficiency. */
666 applyTransactionAsync(rowDataTransaction: RowDataTransaction<TData>, callback?: (res: RowNodeTransaction<TData>) => void): void;
667 /** Executes any remaining asynchronous grid transactions, if any are waiting to be executed. */
668 flushAsyncTransactions(): void;
669 setSuppressModelUpdateAfterUpdateTransaction(value: boolean): void;
670 /**
671 * Marks all the currently loaded blocks in the cache for reload.
672 * If you have 10 blocks in the cache, all 10 will be marked for reload.
673 * The old data will continue to be displayed until the new data is loaded.
674 */
675 refreshInfiniteCache(): void;
676 /**
677 * Purges the cache.
678 * The grid is then told to refresh. Only the blocks required to display the current data on screen are fetched (typically no more than 2).
679 * The grid will display nothing while the new blocks are loaded.
680 * Use this to immediately remove the old data from the user.
681 */
682 purgeInfiniteCache(): void;
683 /**
684 * Refresh a server-side level.
685 * If you pass no parameters, then the top level store is refreshed.
686 * To refresh a child level, pass in the string of keys to get to the desired level.
687 */
688 refreshServerSide(params?: RefreshServerSideParams): void;
689 /** @deprecated v28 use `refreshServerSide` instead */
690 refreshServerSideStore(params?: RefreshServerSideParams): void;
691 /** @deprecated v28 use `getServerSideGroupLevelState` instead */
692 getServerSideStoreState(): ServerSideGroupLevelState[];
693 /** Returns info on all server side group levels. */
694 getServerSideGroupLevelState(): ServerSideGroupLevelState[];
695 /** The row count defines how many rows the grid allows scrolling to. */
696 getInfiniteRowCount(): number | undefined;
697 /** Returns `true` if grid allows for scrolling past the last row to load more rows, thus providing infinite scroll. */
698 isLastRowIndexKnown(): boolean | undefined;
699 /**
700 * Returns an object representing the state of the cache. This is useful for debugging and understanding how the cache is working.
701 */
702 getCacheBlockState(): any;
703 /** Get the index of the first displayed row due to scrolling (includes invisible rendered rows in the buffer). */
704 getFirstDisplayedRow(): number;
705 /** Get the index of the last displayed row due to scrolling (includes invisible rendered rows in the buffer). */
706 getLastDisplayedRow(): number;
707 /** Returns the displayed `RowNode` at the given `index`. */
708 getDisplayedRowAtIndex(index: number): IRowNode<TData> | undefined;
709 /** Returns the total number of displayed rows. */
710 getDisplayedRowCount(): number;
711 /**
712 * Set whether the grid paginates the data or not.
713 * - `true` to enable pagination
714 * - `false` to disable pagination
715 */
716 setPagination(value: boolean): void;
717 /**
718 * Returns `true` when the last page is known.
719 * This will always be `true` if you are using the Client-Side Row Model for pagination.
720 * Returns `false` when the last page is not known; this only happens when using Infinite Row Model.
721 */
722 paginationIsLastPageFound(): boolean;
723 /** Returns how many rows are being shown per page. */
724 paginationGetPageSize(): number;
725 /** Sets the `paginationPageSize`, then re-paginates the grid so the changes are applied immediately. */
726 paginationSetPageSize(size?: number): void;
727 /** Returns the 0-based index of the page which is showing. */
728 paginationGetCurrentPage(): number;
729 /** Returns the total number of pages. Returns `null` if `paginationIsLastPageFound() === false`. */
730 paginationGetTotalPages(): number;
731 /** The total number of rows. Returns `null` if `paginationIsLastPageFound() === false`. */
732 paginationGetRowCount(): number;
733 /** Navigates to the next page. */
734 paginationGoToNextPage(): void;
735 /** Navigates to the previous page. */
736 paginationGoToPreviousPage(): void;
737 /** Navigates to the first page. */
738 paginationGoToFirstPage(): void;
739 /** Navigates to the last page. */
740 paginationGoToLastPage(): void;
741 /** Goes to the specified page. If the page requested doesn't exist, it will go to the last page. */
742 paginationGoToPage(page: number): void;
743}
744
\No newline at end of file