or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

charts-visualization.mddata-processing.mdfiltering-search.mdimport-export.mdindex.mdrow-operations.mdselection-interaction.mdui-components.md
tile.json

data-processing.mddocs/

Data Processing and Management

Advanced data handling capabilities including server-side processing, tree data structures, viewport row models, and batch editing operations.

Capabilities

Server-Side Row Model

Handles large datasets by loading data on-demand from the server with support for grouping, aggregation, pivoting, and filtering.

/**
 * Server-side row model for handling large datasets
 * Loads data on-demand from server with support for operations
 */
interface IServerSideGetRowsParams {
  /** Request parameters including sorting, filtering, grouping */
  request: IServerSideGetRowsRequest;
  /** Success callback with loaded data */
  success: (params: LoadSuccessParams) => void;
  /** Failure callback */
  fail: () => void;
}

interface IServerSideGetRowsRequest {
  /** Zero-based start row index */
  startRow: number;
  /** Zero-based end row index */
  endRow: number;
  /** Row grouping info */
  rowGroupCols: ColumnVO[];
  /** Value column info */
  valueCols: ColumnVO[];
  /** Pivot column info */
  pivotCols: ColumnVO[];
  /** Pivot mode flag */
  pivotMode: boolean;
  /** Group keys for current group level */
  groupKeys: string[];
  /** Filter model */
  filterModel: any;
  /** Sort model */
  sortModel: SortModelItem[];
}

interface LoadSuccessParams {
  /** Row data array */
  rowData: any[];
  /** Total number of rows available */
  rowCount?: number;
  /** Any extra information for the grid to associate with this load */
  groupLevelInfo?: any;
  /** Pivot result field names */
  pivotResultFields?: string[];
}

Usage Example:

import { ServerSideRowModelModule } from "ag-grid-enterprise";

const gridOptions: GridOptions = {
  modules: [ServerSideRowModelModule],
  rowModelType: "serverSide",
  serverSideStoreType: "partial", // or "full"
  
  datasource: {
    getRows: (params: IServerSideGetRowsParams) => {
      // Fetch data from your server
      fetch("/api/data", {
        method: "POST",
        body: JSON.stringify(params.request)
      })
      .then(response => response.json())
      .then(data => {
        params.success({
          rowData: data.rows,
          rowCount: data.totalCount
        });
      })
      .catch(() => params.fail());
    }
  }
};

Tree Data Support

Display hierarchical data in a tree structure with expand/collapse functionality.

/**
 * Tree data configuration properties available on GridOptions
 * These are not separate interfaces but properties on the main GridOptions
 */
interface TreeDataProperties {
  /** Enable tree data mode */
  treeData: boolean;
  /** Function to get the path array for each data item */
  getDataPath: (data: any) => string[];
  /** Function to get child count for lazy loading */
  getChildCount?: (data: any) => number;
  /** Whether to auto-expand groups by default */
  groupDefaultExpanded?: number | ((params: any) => boolean);
}

Usage Example:

import { TreeDataModule } from "ag-grid-enterprise";

// Sample hierarchical data
const rowData = [
  { path: ["Documents"], name: "Documents", type: "folder" },
  { path: ["Documents", "Projects"], name: "Projects", type: "folder" },
  { path: ["Documents", "Projects", "React App"], name: "React App", type: "folder" },
  { path: ["Documents", "Projects", "React App", "src"], name: "src", type: "folder" },
  { path: ["Documents", "Projects", "React App", "src", "App.js"], name: "App.js", type: "file" }
];

const gridOptions: GridOptions = {
  modules: [TreeDataModule],
  treeData: true,
  
  getDataPath: (data) => data.path,
  
  columnDefs: [
    { field: "name", cellRenderer: "agGroupCellRenderer" },
    { field: "type" }
  ],
  
  rowData,
  groupDefaultExpanded: -1 // Expand all levels
};

Viewport Row Model

Optimized for displaying large datasets by rendering only visible rows in a virtual viewport.

/**
 * Viewport row model for efficient rendering of large datasets
 */
interface IViewportDatasource {
  /** Initialize the viewport datasource */
  init: (params: IViewportDatasourceParams) => void;
  /** Set the viewport range to display */
  setViewportRange: (firstRow: number, lastRow: number) => void;
  /** Destroy the datasource */
  destroy?: () => void;
}

interface IViewportDatasourceParams {
  /** Callback to set row data */
  setRowData: (rowData: {[key: number]: any}) => void;
  /** Callback to set row count */
  setRowCount: (rowCount: number, keepRenderedRows?: boolean) => void;
  /** Get currently rendered row count */
  getRow: (rowIndex: number) => any;
}

Usage Example:

import { ViewportRowModelModule } from "ag-grid-enterprise";

const gridOptions: GridOptions = {
  modules: [ViewportRowModelModule],
  rowModelType: "viewport",
  
  viewportDatasource: {
    init: (params) => {
      // Initialize your data source
      params.setRowCount(1000000); // Set total row count
    },
    
    setViewportRange: (firstRow, lastRow) => {
      // Load data for the visible range
      const rowData: {[key: number]: any} = {};
      for (let i = firstRow; i <= lastRow; i++) {
        rowData[i] = { id: i, name: `Row ${i}`, value: Math.random() };
      }
      params.setRowData(rowData);
    }
  }
};

Batch Editing

Support for batch editing operations across multiple cells and rows.

/**
 * Batch editing API methods available on GridApi
 * These are methods, not a separate service interface
 */
interface GridApiBatchEditMethods {
  /** Start a new batch edit transaction */
  startBatchEdit(): void;
  /** Commit all changes in the current batch */
  commitBatchEdit(): void;
  /** Cancel all changes in the current batch */
  cancelBatchEdit(): void;
  /** Get the current batch edit state */
  isBatchEditing(): boolean;
}

Usage Example:

import { BatchEditModule } from "ag-grid-enterprise";

const gridOptions: GridOptions = {
  modules: [BatchEditModule],
  
  onCellEditingStarted: (event) => {
    // Start batch editing when user begins editing
    gridApi.startBatchEdit();
  },
  
  onCellEditingStopped: (event) => {
    // Option to commit or cancel batch
    if (event.newValue !== event.oldValue) {
      gridApi.commitBatchEdit(); // Apply changes
    } else {
      gridApi.cancelBatchEdit(); // Cancel changes
    }
  }
};

// Programmatic batch operations
gridApi.applyTransaction({
  add: [
    { id: 1, name: "New Row 1" },
    { id: 2, name: "New Row 2" }
  ],
  update: [
    { id: 3, name: "Updated Row" }
  ],
  remove: [
    { id: 4 }
  ]
});

Types

// Column value object for server-side operations
interface ColumnVO {
  id: string;
  displayName: string;
  field?: string;
  aggFunc?: string;
}

// Sort model item
interface SortModelItem {
  colId: string;
  sort: "asc" | "desc";
}

// Viewport datasource parameters
interface IViewportDatasourceParams {
  setRowData: (rowData: {[key: number]: any}) => void;
  setRowCount: (rowCount: number, keepRenderedRows?: boolean) => void;
  getRow: (rowIndex: number) => any;
}

// Tree data configuration (properties available on GridOptions)
interface TreeDataProperties {
  treeData: boolean;
  getDataPath: (data: any) => string[];
  getChildCount?: (data: any) => number;
  groupDefaultExpanded?: number | ((params: any) => boolean);
}