1 | // Type definitions for ag-grid v18.1.2
|
2 | // Project: http://www.ag-grid.com/
|
3 | // Definitions by: Niall Crosby <https://github.com/ag-grid/>
|
4 | import { RowNode } from "../entities/rowNode";
|
5 | export interface IViewportDatasource {
|
6 | /** Gets called exactly once before viewPort is used. Passes methods to be used to tell viewPort of data loads / changes. */
|
7 | init(params: IViewportDatasourceParams): void;
|
8 | /** Tell the viewport what the scroll position of the grid is, so it knows what rows it has to get */
|
9 | setViewportRange(firstRow: number, lastRow: number): void;
|
10 | /** Gets called once when viewPort is no longer used. If you need to do any cleanup, do it here. */
|
11 | destroy?(): void;
|
12 | }
|
13 | export interface IViewportDatasourceParams {
|
14 | /** datasource calls this method when the total row count changes. This in turn sets the height of the grids vertical scroll. */
|
15 | setRowCount: (count: number) => void;
|
16 | /** datasource calls this when new data arrives. The grid then updates the provided rows. The rows are mapped [rowIndex]=>rowData].*/
|
17 | setRowData: (rowData: {
|
18 | [key: number]: any;
|
19 | }) => void;
|
20 | /** datasource calls this when it wants a row node - typically used when it wants to update the row node */
|
21 | getRow: (rowIndex: number) => RowNode;
|
22 | }
|