iRowModel.d.ts 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { RowNode } from "../entities/rowNode";
  2. export interface RowBounds {
  3. rowTop: number;
  4. rowHeight: number;
  5. rowIndex?: number;
  6. }
  7. export interface IRowModel {
  8. /** Returns the rowNode at the given index. */
  9. getRow(index: number): RowNode | null;
  10. /** Returns the rowNode for given id. */
  11. getRowNode(id: string): RowNode | null;
  12. /** This is legacy, not used by ag-Grid, but keeping for backward compatibility */
  13. getRowCount(): number;
  14. getTopLevelRowCount(): number;
  15. getTopLevelRowDisplayedIndex(topLevelIndex: number): number;
  16. /** Returns the row index at the given pixel */
  17. getRowIndexAtPixel(pixel: number): number;
  18. /** Returns total height of all the rows - used to size the height of the grid div that contains the rows */
  19. getCurrentPageHeight(): number;
  20. /** Returns true if the provided rowNode is in the list of rows to render */
  21. isRowPresent(rowNode: RowNode): boolean;
  22. /** Returns row top and bottom for a given row */
  23. getRowBounds(index: number): RowBounds | null;
  24. /** Returns true if this model has no rows, regardless of model filter. EG if rows present, but filtered
  25. * out, this still returns false. If it returns true, then the grid shows the 'no rows' overlay - but we
  26. * don't show that overlay if the rows are just filtered out. */
  27. isEmpty(): boolean;
  28. /** Returns true if no rows (either no rows at all, or the rows are filtered out). This is what the grid
  29. * uses to know if there are rows to render or not. */
  30. isRowsToRender(): boolean;
  31. /** Returns all rows in range that should be selected. If there is a gap in range (non ClientSideRowModel) then
  32. * then no rows should be returned */
  33. getNodesInRangeForSelection(first: RowNode, last: RowNode): RowNode[];
  34. /** Iterate through each node. What this does depends on the model type. For clientSide, goes through
  35. * all nodes. For pagination, goes through current page. For virtualPage, goes through what's loaded in memory. */
  36. forEachNode(callback: (rowNode: RowNode, index: number) => void): void;
  37. /** The base class returns the type. We use this instead of 'instanceof' as the client might provide
  38. * their own implementation of the models in the future. */
  39. getType(): string;
  40. /**
  41. * It tells us if this row model knows about the last row that it can produce. This is used by the
  42. * PaginationPanel, if last row is not found, then the 'last' button is disabled and the last page is
  43. * not shown. This is always true for ClientSideRowModel. It toggles for InfiniteRowModel.
  44. */
  45. isLastRowFound(): boolean;
  46. /** Used by CSRM only - is makes sure there are now estimated row heights within the range. */
  47. ensureRowHeightsValid(startPixel: number, endPixel: number, startLimitIndex: number, endLimitIndex: number): boolean;
  48. /** Gets called after grid is initialised. What happens depends on row model. Client Side will take rowData
  49. * from gridOptions, the other row models will start calling their datasources. */
  50. start(): void;
  51. }