UNPKG

1.2 kBTypeScriptView Raw
1import { SortModelItem } from "../sortController";
2/** Datasource used by both PaginationController and InfiniteRowModel */
3export interface IDatasource {
4 /** If you know up front how many rows are in the dataset, set it here. Otherwise leave blank. */
5 rowCount?: number;
6 /** Callback the grid calls that you implement to fetch rows from the server. */
7 getRows(params: IGetRowsParams): void;
8 /** Optional destroy method, if your datasource has state it needs to clean up. */
9 destroy?(): void;
10}
11/** Params for the above IDatasource.getRows() */
12export interface IGetRowsParams {
13 /** The first row index to get. */
14 startRow: number;
15 /** The first row index to NOT get. */
16 endRow: number;
17 /** Callback to call for the result when successful. */
18 successCallback(rowsThisBlock: any[], lastRow?: number): void;
19 /** Callback to call when the request fails. */
20 failCallback(): void;
21 /** If doing server side sorting, contains the sort model */
22 sortModel: SortModelItem[];
23 /** If doing server side filtering, contains the filter model */
24 filterModel: any;
25 /** The context as provided on `gridOptions.context` */
26 context: any;
27}