iViewportDatasource.d.ts 1.1 KB

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