Skip to content

Datagrid (Advanced)

The advanced datagrid component allows you to display and interact with structured data in a tabular format. Built on the AG Grid framework, it offers high-performance rendering with advanced features like sorting, filtering, pagination, and cell editing. You can fully customize its appearance and behavior to meet your specific requirements.

Features

  • High-Performance Rendering: Efficiently handles large datasets with virtual scrolling
  • Advanced Sorting & Filtering: Helps users quickly find and organize data
  • Row Selection: Single or multiple row selection with full event handling
  • Interactive Cell Editing: Edit data directly within the grid with validation
  • Custom Cells: Add your own UI components to grid cells
  • Pagination: Traditional page-based navigation for structured data review
  • Column Management: Resize, reorder, and pin columns as needed
  • Comprehensive Styling: Extensive appearance customization for all grid elements

Getting Started

Using AI

The quickest way to set up the datagrid is by using AI.

  1. First, ensure you have a variable or collection with your data ready.
  2. Ask AI: "Create a datagrid that uses {{insert your data}}". Make sure you pass in your data as context in the chat.

Setting up a datagrid with AI

  1. Continue refining and customizing your datagrid by asking AI for specific modifications:
    • "Add an action column with an 'Edit' button"
    • "Enable multiple row selection on the datagrid"
    • "Make the email column wider and show the status column with color indicators"
    • "Add pagination showing 5 rows per page"

Update a datagrid with AI

Manual Setup

  1. Add the datagrid to your page from the Add panel
  2. Configure the data source:
    • Click the Data property and select a variable or collection
    • Set a unique row ID formula (typically using the primary key of your data)
    • Click Generate Columns to create columns based on your data structure

Binding data to datagrid

  1. Customize columns as needed through the properties panel
  2. Configure appearance settings in the Style panel
  3. Add workflows to handle interactions like row selection or action buttons

TIP

When binding data to the datagrid, it is optimal for your data to be an array of objects, as this will allow the automatic generation of columns.

If you are unsure what an 'array of objects' means, please refer to our guide on understanding variables: Variables Guide.

Column Configuration

The datagrid organizes your data into columns that can be extensively customized.

Column Types

TypeBest For
TextString data
NumberNumeric values
BooleanTrue/false values
DateDate strings
ImageImage URLs
ActionInteractive buttons
CustomComplex elements

Custom Display Formatting

For Text, Number, Boolean, and Date columns, you can customize how values are displayed without changing the underlying data:

  1. Select a column in the properties panel
  2. Toggle on Custom display value
  3. Create a formula that transforms the raw value into your desired format

Edit cell value

Interactive Features

Cell Editing

Enable users to edit data directly in the grid:

  1. Select a column in the properties panel
  2. Toggle on Editable
Toggle Edition
  1. Users can now double-click a cell to edit its content

Edit cell value

  1. Create a workflow on the datagrid using the On Cell Value Changed trigger
On Cell Value Change
  1. In your workflow, you'll have access to:
    • The old value
    • The new value
    • Which column was changed
    • The complete row data
Cell Edited Valuese

Row Selection

Allow users to select one or multiple rows:

  1. In the datagrid properties, set Row Selection to either Single or Multiple
  2. Users can now select rows by clicking on them

Row Selection

  1. Create workflows for selection events:
    • On Row Selected: Triggered when a row is selected
    • On Row Deselected: Triggered when a row is deselected
Row Selection WorkflowRow Deselection Workflow
  1. Access all currently selected rows via the exposed selectedRows variable OR access only the data of the row that triggered the On Row Selected or On Row Deselected event
Rows Selected Variable DataRow Selected Event Data

Action Buttons

Add interactive buttons to each row of your datagrid:

  1. Add a new column with type set to Action
  2. Configure:
    • Action Name: Identifier for the action (used in workflows)
    • Action Label: Text displayed on the button

Setting up action buttons

  1. Create a workflow on the datagrid using the On Action trigger
  2. In your workflow, you'll have access to:
    • Which action was triggered
    • The complete row data

Setting up action workflow

Custom Cell Content

Create completely custom cell rendering:

  1. Add a column with type set to Custom
  2. A Dropzone appears on the canvas where you can add any UI elements
  3. Drag and drop elements into this dropzone to create your custom cell appearance
  4. These elements will have access to the cell value and the entire row data

Using Datagrid Custom Column

Managing Large Datasets

The datagrid provides two approaches to handling large amounts of data:

Virtual Scrolling (Default)

By default, the datagrid uses virtual scrolling to efficiently render large datasets:

  • Only visible rows are rendered in the DOM
  • Rows load dynamically as users scroll
  • Provides smooth performance even with thousands of rows

Using Virtual Scroll

Pagination

For a more traditional approach to large datasets:

  1. Toggle on Pagination in the datagrid properties
  2. Set the desired number of rows per page (default: 10)
Pagination

The datagrid will now display page navigation controls, and users can browse through pages of data.

Using Pagination

Advanced Usage

Dynamic Column Definition

For programmatically defining columns, bind the columns property to a variable with this structure:

javascript
[
    {
        "headerName": "Name",
        "cellDataType": "text", 
        "field": "name",
        "width": "200px",
        "sortable": true
    },
    {
        "headerName": "Price",
        "cellDataType": "number",
        "field": "price", 
        "width": "100px",
        "sortable": true
    },
    {
        "headerName": "In Stock",
        "cellDataType": "boolean",
        "field": "inStock",
        "width": "100px"
    },
    {
        "headerName": "Product Image",
        "cellDataType": "image",
        "field": "thumbnail",
        "imageWidth": "50px",
        "imageHeight": "50px"
    },
    {
        "headerName": "Actions", 
        "cellDataType": "action",
        "field": "edit",
        "actionName": "editRow",
        "actionLabel": "Edit"
    }
]

Column Width Strategies

The datagrid offers two approaches to handling column widths:

  1. Fixed Width: Set a specific pixel width for the column

    • Good for consistent layouts
    • Best for columns with predictable content length
  2. Flex Width: Distribute available space proportionally

    • Adapts to different screen sizes
    • Set flex values to control relative proportions

Column Pinning

For tables with many columns, pin important columns to ensure they stay visible:

  1. Set the Pinned property to either Left or Right
  2. Pinned columns remain fixed while users scroll horizontally
  3. Useful for ID columns, status indicators, or action buttons

Pinning Column

Example Use Cases

  • Product Catalog: Display products with images, pricing, inventory status, and edit/view actions
  • User Management: List users with filterable columns for roles, status, and registration dates
  • Financial Dashboard: Present financial data with custom number formatting and row selection
  • Task Tracker: Show tasks with status indicators, due dates, and action buttons
  • Data Analysis: Enable sorting and filtering for data exploration with visual indicators

Forking

While the DataGrid component offers extensive built-in customization options, there may be cases where you need functionality beyond what's natively available. In these situations, you can fork the component and modify it to meet your specific requirements.

If you are unsure how to fork an element, you can learn more in the dedicated documentation.

Forking Example: Custom Pagination Styling

One reason to fork the DataGrid would be to create styling properties not available in the standard component. For example, you might want to be able to change the styling of the pagination.

To do so, you could fork the datagrid, then edit with AI and pass in the following prompt:

I want to edit this forked datagrid so that I can change the styling of the pagination

The AI will then add new styling properties to control the appearance of different aspects of the pagination: Controlling Pagination Styling

Properties Reference

Settings Properties

PropertyOptions/TypeDescription
DataCollection/ArrayThe data to display in the grid
Unique Row IDFormulaWhat to use for the Unique ID of each row
ColumnsArrayConfiguration for each column in the grid
Row SelectionNone, Single, MultipleDetermines how users can select rows
PaginationBooleanEnable/disable pagination for large datasets
Rows Per PageNumberNumber of rows to display per page (when pagination is enabled)
Movable ColumnsBooleanAllow users to reorder columns via drag and drop
Resizable ColumnsBooleanAllow users to adjust column widths

Column Properties

Each column in the datagrid can be configured with these properties:

PropertyOptions/TypeDescription
Header NameTextThe title displayed at the top of the column
TypeText, Number, Boolean, Date, Image, Action, CustomThe type of data in this column
KeyTextThe field name from your data source
WidthFixed/FlexColumn width approach (fixed pixel width or flexible)
Min WidthPixelsMinimum column width
Max WidthPixelsMaximum column width
FilterBooleanEnable/disable filtering for this column
SortableBooleanEnable/disable sorting for this column
PinnedNone, Left, RightPin the column to the edge of the grid
EditableBooleanAllow users to edit cell values
Custom DisplayBooleanUse a formula to format how values are displayed

Image Column Properties

PropertyDescription
Image WidthWidth of the displayed image
Image HeightHeight of the displayed image

Action Column Properties

PropertyDescription
Action NameIdentifier for the action (used in workflows)
Action LabelText displayed on the button

Styling Properties

General

PropertyDescription
Height ModeChoose between Fixed height or Auto (based on content)
Grid HeightSet the height of the grid when using Fixed mode
Text ColorGlobal text color for the grid
Border ColorColor of grid borders
PropertyDescription
Background ColorSet the background color of the header row
Text ColorSet the color of header text
Font WeightControl the boldness of header text
Font SizeAdjust the size of header text
Font FamilyChoose the font for header text

Row

PropertyDescription
Background ColorSet the background color of rows
Alternate ColorSet the color for alternating rows
Hover ColorSet the background color when hovering over rows
Vertical Padding ScaleAdjust vertical spacing in rows (0-5)
Selected Background ColorHighlight color for selected rows

Column

PropertyDescription
Hover HighlightToggle column highlight effect on hover
Hover ColorSet the color for the column hover effect

Cell

PropertyDescription
Text ColorSet the color of cell text
Font FamilyChoose the font for cell text
Font SizeAdjust the size of cell text
PropertyDescription
Text ColorSet the color of text in filter menus
Background ColorSet the background color of filter menus

Action

PropertyDescription
Text ColorSet the color of action button text
Background ColorSet the background color of action buttons
PaddingAdd space around action button text
BorderSet the border style for action buttons
Border RadiusControl the roundness of action button corners
Font SettingsConfigure typography for action buttons

Event Triggers

The datagrid component provides events you can use to trigger workflows:

EventDescriptionPayload
On ActionTriggered when an action button is clicked{ actionName, row, id, index, displayIndex }
On Cell Value ChangedTriggered after a cell value is edited{ oldValue, newValue, columnId, row }
On Row SelectedTriggered when a row is selected{ row }
On Row DeselectedTriggered when a row is deselected{ row }

Example Event Payloads

On Action

javascript
{
  actionName: "edit",
  row: {
    id: 42,
    name: "Product A",
    price: 29.99,
    inStock: true
  },
  id: 42,
  index: 5,
  displayIndex: 2
}

On Cell Value Changed

javascript
{
  oldValue: 29.99,
  newValue: 24.99,
  columnId: "price",
  row: {
    id: 42,
    name: "Product A",
    price: 24.99,
    inStock: true
  }
}

On Row Selected / On Row Deselected

javascript
{
  row: {
    id: 42,
    name: "Product A",
    price: 29.99,
    inStock: true
  }
}

Exposed Variables

The datagrid component exposes the following variables for use in your application:

VariableDescription
selectedRowsArray