Results:
Loading...

JavaScript Data GridSSRM API ReferenceEnterprise

The section lists the available Server-Side Row Model (SSRM) options.

SSRM Grid Options

serverSideDatasource
Provide the serverSideDatasource for server side row model. See Registering the Datasource.
serverSideDatasource: IServerSideDatasource;

interface IServerSideDatasource {
  // Grid calls `getRows` when it requires more rows as specified in the params.
  // Params object contains callbacks for responding to the request.
  getRows(params: IServerSideGetRowsParams): void;
  // Optional method, if your datasource has state it needs to clean up. 
  destroy?(): void;
}

interface IServerSideGetRowsParams<TData = any, TContext = any> {
  // Details for the request. A simple object that can be converted to JSON.
  request: IServerSideGetRowsRequest;
  // The parent row node. The RootNode (level -1) if request is top level.
  // This is NOT part fo the request as it cannot be serialised to JSON (a rowNode has methods).
  parentNode: IRowNode;
  // Success callback, pass the rows back to the grid that were requested.
  success(params: LoadSuccessParams): void;
  // Fail callback, tell the grid the call failed so it can adjust it's state.
  fail(): void;
  // The grid api. 
  api: GridApi<TData>;
  // The column api. 
  columnApi: ColumnApi;
  // Application context as set on `gridOptions.context`. 
  context: TContext;
}

interface IServerSideGetRowsRequest {
  // First row requested or undefined for all rows. 
  startRow: number | undefined;
  // Index after the last row required row or undefined for all rows. 
  endRow: number | undefined;
  // Columns that are currently row grouped.  
  rowGroupCols: ColumnVO[];
  // Columns that have aggregations on them.  
  valueCols: ColumnVO[];
  // Columns that have pivot on them.  
  pivotCols: ColumnVO[];
  // Defines if pivot mode is on or off.  
  pivotMode: boolean;
  // What groups the user is viewing.  
  groupKeys: string[];
  // If filtering, what the filter model is.  
  filterModel: any;
  // If sorting, what the sort model is.  
  sortModel: SortModelItem[];
}

interface ColumnVO {
  id: string;
  displayName: string;
  field?: string;
  aggFunc?: string;
}

interface SortModelItem {
  // Column Id to apply the sort to. 
  colId: string;
  // Sort direction 
  sort: 'asc' | 'desc';
}

interface LoadSuccessParams {
  // Data retrieved from the server as requested by the grid.
  rowData: any[];
  // The last row, if known, to help Infinite Scroll.
  rowCount?: number;
  // Any extra information for the grid to associate with this load.
  groupLevelInfo?: any;
}
cacheBlockSize
number
How many rows for each block in the cache, i.e. how many rows returned from the server at a time.
Default: 100
maxBlocksInCache
number
How many blocks to keep in the cache. Default is no limit, so every requested block is kept. Use this if you have memory concerns, and blocks that were least recently viewed will be purged when the limit is hit. The grid will additionally make sure it has all the blocks needed to display what is currently visible, in case this property is set to a low value.
maxConcurrentDatasourceRequests
number
How many requests to hit the server with concurrently. If the max is reached, requests are queued. Set to -1 for no maximum restriction on requests.
Default: 2
blockLoadDebounceMillis
number
How many milliseconds to wait before loading a block. Useful when scrolling over many blocks, as it prevents blocks loading until scrolling has settled. See Block Loading Debounce.
purgeClosedRowNodes
boolean
When enabled, closing group rows will remove children of that row. Next time the row is opened, child rows will be read from the datasource again. This property only applies when there is Row Grouping.
Default: false
serverSideSortAllLevels
boolean
When enabled, always refreshes top level groups regardless of which column was sorted. This property only applies when there is Row Grouping & sorting is handled on the server.
Default: false
serverSideFilterAllLevels
boolean
When enabled, always refreshes top level groups regardless of which column was filtered. This property only applies when there is Row Grouping & filtering is handled on the server.
Default: false
serverSideInitialRowCount
number
Set how many loading rows to display to the user for the root level group. See Initial Scroll Position.
Default: 1
suppressServerSideInfiniteScroll
boolean
When true, the Server-side Row Model will suppress Infinite Scrolling and load all the data at the current level.
Default: false
serverSideSortOnServer
boolean
When enabled, Sorting will be done on the server. Only applicable when suppressServerSideInfiniteScroll=true.
Default: false
serverSideFilterOnServer
boolean
When enabled, Filtering will be done on the server. Only applicable when suppressServerSideInfiniteScroll=true.
Default: false
getChildCount
Function
Allows setting the child count for a group row.
getChildCount = (dataItem: any) => number;
getServerSideGroupLevelParams
Function
Allows providing different params for different levels of grouping.
getServerSideGroupLevelParams = (
    params: GetServerSideGroupLevelParamsParams
) => ServerSideGroupLevelParams;

interface GetServerSideGroupLevelParamsParams {
  // The level of the store. Top level is 0. 
  level: number;
  // The Row Node for the group that got expanded, or undefined if top level (ie no parent) 
  parentRowNode?: IRowNode;
  // Active Row Group Columns, if any. 
  rowGroupColumns: Column[];
  // Active Pivot Columns, if any. 
  pivotColumns: Column[];
  // true if pivot mode is active. 
  pivotMode: boolean;
  // The grid api. 
  api: GridApi<any>;
  // The column api. 
  columnApi: ColumnApi;
  // Application context as set on `gridOptions.context`. 
  context: any;
}

interface ServerSideGroupLevelParams {
  // Whether to have infinite scroll active or not for the level.
  suppressInfiniteScroll?: boolean;
  // For Infinite Scroll only.
  // How many blocks to keep in cache.
  // If missing, defaults to grid options `maxBlocksInCache`.
  maxBlocksInCache?: number;
  // For Infinite Scroll only.
  // Cache block size.
  // If missing, defaults to grid options `cacheBlockSize`.
  cacheBlockSize?: number;
}
isServerSideGroupOpenByDefault
Function
Allows groups to be open by default.
isServerSideGroupOpenByDefault = (
    params: IsServerSideGroupOpenByDefaultParams
) => boolean;

interface IsServerSideGroupOpenByDefaultParams {
  data: any;
  rowNode: IRowNode;
  // The grid api. 
  api: GridApi<any>;
  // The column api. 
  columnApi: ColumnApi;
  // Application context as set on `gridOptions.context`. 
  context: any;
}
isApplyServerSideTransaction
Function
Allows cancelling transactions.
isApplyServerSideTransaction = (
    params: IsApplyServerSideTransactionParams
) => boolean;

interface IsApplyServerSideTransactionParams {
  // The transaction getting applied. 
  transaction: ServerSideTransaction;
  // The parent RowNode, if transaction is applied to a group. 
  parentNode: IRowNode;
  // Store info, if any, as passed via the success() callback when loading data. 
  groupLevelInfo: any;
  // The grid api. 
  api: GridApi<any>;
  // The column api. 
  columnApi: ColumnApi;
  // Application context as set on `gridOptions.context`. 
  context: any;
}
isServerSideGroup
Function
SSRM Tree Data: Allows specifying which rows are expandable. See SSRM Tree Data.
isServerSideGroup = (dataItem: any) => boolean;
getServerSideGroupKey
Function
SSRM Tree Data: Allows specifying group keys. See SSRM Tree Data.
getServerSideGroupKey = (dataItem: any) => string;

Next Up

Continue to the next section to learn about the Server-Side Datasource.