Data Grid 2

Last modified: August 4, 2025

Introduction

Data Grid 2 is the successor to the standard data grid widget for displaying content in a tabular form. It comes with many powerful new features and settings like support for widgets, row and cell coloring, responsive layout, accessibility, and paging options like virtual scrolling. The Data Grid 2 widget offers personalization support so that end-users can show, hide, and re-order columns. Personalizations can be persisted in the database for flexibility and control.

This document focusing on explaining module features. For precise details on data grid 2 widget properties, see Data Grid 2 Properties.

The data source determines which objects will be shown in a Data Grid 2 widget. In v2.3.0 and above, selecting the entity of the data source will automatically fill the contents, create columns with filters, and create buttons. You can also select which columns to use for the content generation.

The widget uses a flexible, modular approach for filtering. You can place dedicated filter widgets (text filter, date filter, number filter, dropdown filter) in the filters placeholder above the grid, or within individual column headers. These specialized filter widgets provide tailored behavior for different data types and use cases. This system is superior to a built-in filtering system in that it allows for a more maintainable and customizable architecture.

Here is an example of a data grid using filters:

Example of data grid using filters

You can enable these advanced options to customize your data grid:

  • Pagination type and positioning
  • Row count display
  • Loading state indicators
  • Empty list option
  • Dynamic row and cell class
  • Column capabilities
  • Filter personalization settings
  • Custom configuration
  • Modular filtering with dedicated filter widgets

Capabilities

In the new data grid, you are able to choose how users can iterate within the grid. Iteration capabilities are listed below.

Sorting

Sorting enables the header to be clickable. When clicked it will switch between ascending, descending, and no sorting. This functionality can be discerned according to the arrows on the right side:

  • Arrow up: ascending sorting applied
  • Arrow down: descending sorting applied
  • Double-sided arrow: no sorting is applied

Ascending sort
Descending sort
Natural order (No sorting)

Resizing

Resizing enables the header to be resizable by dragging the handle on the right side of a header. Here is an example of the handle indicating the column is resizable:

Handle indicating the column is resizable

Reordering

Reordering enables the header to be reordered by dragging and dropping in another column. When dragging, a black handle indicates where the column can be dropped:

Here is an example of reordering in progress:

Example of reordering

Hiding

Hiding enables a column to be hidden. When this option is enabled for any column, a button with an eye icon ( ) will appear on the right side of the data grid like the example below. It contains all the columns hidden by default or enabled to be hidden. When de-selected, the column will not be visible in the grid anymore.

Here is an example of hiding button containing columns to be hidden:

Example of hiding button containing columns to be hidden

Here is an example containing a column with Yes, hidden by default in Structure mode:

Example containing a column with “Yes, hidden by default” in Structure mode

Here is an example containing a column with Yes, hidden by default in Design mode:

Example containing a column with “Yes, hidden by default” in Design mode

Allow Row Events

When set to Yes, default events such as On click action or selection will be triggered when the user interacts with the content.

Pagination

In the new data grid we offer two types of pagination: Paging Buttons and Virtual Scrolling.

Paging Buttons

The Paging Buttons option will render the default buttons as the previous data grid. When the data source is uncountable (for example, external entities), neither the last page button nor the counting will be available.

Example of paging buttons

You can configure pagination based on the following properties:

  • Position — The Position of paging button options allow you to position paging buttons above or below the data grid.
  • Visibility — The Show paging buttons options allow you to always show paging, or to automatically show and hide paging based on the amount of available data compared to the display limit per page.

Virtual Scrolling

The Virtual Scrolling option forces the data grid to show a fixed amount of items (defined in the page size option) within a scrollable container. When the end-user reaches the bottom of the scrollable container it fetches more items automatically.

Load More

This option functions similarly to the Virtual Scrolling feature, but instead of automatically loading data as the end-user scrolls, a button is displayed at the end of the list of items. Clicking this button enables the end-user to fetch more items.

Row Count Display

When enabled, the pagination area displays the total number of rows alongside navigation controls. This provides users with context about the data set size. The counter shows information such as "1 to 20 of 150", and automatically updates when users navigate between pages, apply filters, or refresh data. This feature works with all pagination modes including virtual scrolling and load more.

Columns

In Data Grid you can choose what you want to render into columns. This can be an attribute, dynamic text, or even a combination of widgets (custom content). To choose what you want to render, open a column in the column list and select the appropriate option according to your needs.

Here is an example of column properties:

Example of column properties

Attribute

Attribute renders the value of a selected attribute.

Dynamic Text

Dynamic Text renders a text-templated string which can contain text combined with attributes:

Example of dynamic text

Custom Content

Custom Content allows users to drop widgets into the data grid and use the column attribute value to show custom content. After selecting this option you will be given dropzones in which to drop your widgets.

Here is an example of custom content using new Badge widget in Structure mode:

Example of custom content using new Badge widget in Structure mode

For more information on configuring various widget properties, see Common Widget Properties.

Column Width

You can define how each cell will be rendered in the data grid. We offer three choices:

Settings for column width for each column item
  • Auto-fill — With this option it will auto define the width of your column, if all columns are using auto-fill, it will divide evenly the same width, if another column is configured with auto-fit or manual, it will fill the available space.
  • Auto-fit — Content With this option it will calculate the width of your column based on the content of each row.
  • Manual — With this option you will manually define the size of your column based of flexbox grow values, for more information, please check here.

Alignment

You can choose how the content inside your columns will be aligned. We offer three choices: left, center, and right.

Settings for alignment of each column item

Dynamic Cell Class

In the new data grid we offer an option to dynamically apply a CSS class in a specific cell. You can achieve this by adding an expression based on the column value (attribute) like the example below.

In this example we check the value of StringAttribute and then apply the class .my-name-class if the attribute is equal to my name to the cell:

Example of dynamic cell class

Wrap Text

You can choose if you want to wrap the text content of a column and apply ellipsis in the end of it.

Example of wrap text

Tooltip

If you need to display advisory information for cell content, you can specify the tooltip text. This text will be shown when a user is hovering over the cell content.

Example of wrap text

Association Filter

The dropdown filter widget supports association filtering when configured in custom mode:

  • Entity (Association) — defines the association that will be used for filtering
  • Selectable objects — defines data source for filter options, returning list of all possible entities that could be associated
  • Use lazy load — controls when filter options are loaded. When set to No (recommended), data is fetched immediately providing better personalization support. When set to Yes, data is fetched only when the filter is opened, improving initial load times but limiting personalization capabilities
  • Option caption — expression used as caption for each option in the dropdown

Visible

When using a data grid, sometimes columns do not need to be shown. Using this Visible expression configuration, you can specify when you want to display columns

Rows

This section defines options for the rows of the grid.

Empty List Message

The Empty List Message option defines what users can see when the data grid does not have a value to be presented or when a filter is applied without results. When this option is defined as custom you can place widgets right above the rows in a dropzone. Here is an example:

Example of empty list message placeholder in Structure mode

Dynamic Row Class

The Dynamic Row Class option allows users to dynamically apply a CSS class in a specific row. This option will apply for the entire row the same class. You can achieve this by adding an expression based on the column value (attribute), like the example below.

In this example we check the value of StringAttribute and then apply the class .my-name-class if the attribute is equal to my name to the row:

Example of dynamic row class

Events

The new data grid can trigger some events while iterating with it.

On Click Action

Triggers an action (such as a nanoflow, microflow, or Show page action) when the end-user clicks in one of the rows. It also adds a pointer cursor to signal that it is clickable. This function also complies with accessibility features and can be reached using only the keyboard.

Filters

Data Grid 2 uses a modular filtering system with dedicated filter widgets that can be placed in two locations:

  • Column Headers: Individual filters can be placed in column headers by enabling Show column filters. When this option is selected, a drop zone appears in each column header where you can place the appropriate filter widget.
  • Filters Placeholder: Grid-wide filters can be placed in the filters placeholder. This allows for filtering across multiple attributes and more complex filtering scenarios.

Filter Widget Configuration

All filter widgets support two configuration modes:

  • Auto Mode: automatically detects filterable attributes from the parent grid (works when placed in grid columns)
  • Custom Mode: allows manual specification of target data source and attributes for more flexible filtering scenarios
Settings for data grid 2

Here is an example of dropzones for filters in Structure mode:

Example of dropzones for filters in Structure mode

Date Filter

Example of default Date filter look and feel

Date filter allows users to match date attributes based on these predefined criteria:

  • Between
  • Greater than
  • Greater than or equal
  • Equal
  • Not equal
  • Smaller than
  • Smaller than or equal

Here is an example of Date filter as Between:

Date filter between

You can select your filter criteria in the Date Filter settings:

Date filter settings

When Adjustable by user is defined as No it will not render the option to choose the filter type in the widget.

Here is an example of available filter types for Date Filter:

Filter types for Date Filter

Here is an example of Date Filter with Adjustable by user defined as No:

Example of Date filter with “Adjustable by user” set as No

You can also define the default value of the widget which will be predefined as initial value when opening your data grid page.

When Default filter is defined as Between these fields will appear to define the start and end dates:

Example of Date filter with “Default value” set as Between

Configurations

In this section you can select a Saved attribute in order to save the current value of the filter. However, the value is not automatically applied to the widget. To restore the previously saved value of the filter, you must configure the same attribute as the Default value of the widget. The attribute available in this section must be this type:

  • Date & Time

Events

In this section you can select an action to be executed On change by the filter value. This means every time the user types or selects a value it will be executed.

Example of default drop-down filter

Drop-down filter allows users to match enumeration values, Boolean attributes, or an association attribute. The filter can be configured to work in Auto mode (detecting attributes from grid context) or custom mode (manual data source and attribute specification).

In custom mode, you can manually configure the data source and attributes, while Auto mode automatically inherits configuration from the parent column. The filter supports both attribute-based filtering (enumerations, booleans) and association-based filtering (references to other entities).

For association filtering, you can configure:

  • Filter by Association: sets the filter to operate on entity associations
  • Entity: selects the target association for filtering
  • Selectable objects: configures the data source that provides available filter options
  • Use lazy load: controls when options are loaded (immediate vs on-demand)
  • Option caption: defines how each option is displayed to users

The filter also supports enhanced features like multi-select, filterable options (combobox-style), and various selection methods (checkbox or row click).

Example of settings for drop-down filter

When adding a new option, the following properties are required:

  • Caption — The text being rendered for each option in the drop-down.
  • Value — The corresponding value that will be compared, if a value is being compared with an enumeration, it should match exactly the enumeration value. This property allows the usage of expression (you can use conditionals to apply dynamic values).
Example of settings for new option

This widget also allows multiple selections by selecting Multiselect in the settings. Multiple selections can look like this:

Example of multi select drop-down filter

You can also define the empty option caption, which will be rendered as the first item if Multiselect if set as No. It allows users to clean the filter if pressed.

Configurations

In this section you can select a Saved attribute in order to save the current value of the filter. However, the value is not automatically applied to the widget. To restore the previously saved value of the filter, you must configure the same attribute as the Default value of the widget. The attribute available in this section must be this type:

  • String

Events

In this section you can select an action to be executed On change by the filter value. This means every time the user types or selects a value it will be executed.

Number Filter

Example of default number filter

The Number filter allows users to match decimal, integer, and long attributes based on these predefined criteria:

  • Greater than
  • Greater than or equal
  • Equal
  • Not equal
  • Smaller than
  • Smaller than or equal

You can select your filter criteria in the Number Filter settings:

Number filter settings

When Adjustable by user is defined as No it will not render the option to choose the filter type in the widget.

Here is an example of available filter types for Number Filter:

Filter types for number filter

Here is an example of Number Filter with Adjustable by user set as No:

Example of number filter with “Adjustable by user” set as No

You can also define the default value of the widget, which will be predefined as initial value when opening your data grid page.

To have better control of when the filter will be applied, we offer a Apply after (ms) option under the On change behavior group. This option will only trigger the filter after a predefined period of time while typing. By default, Mendix suggests 500ms.

Configurations

In this section you can select a Saved attribute in order to save the current value of the filter. However, the value is not automatically applied to the widget. To restore the previously saved value of the filter, you must configure the same attribute as the Default value of the widget. The attribute available in this section must be one of the following types:

  • Autonumber
  • Decimal
  • Integer
  • Long

Events

In this section you can select an action to be executed On change by the filter value. This means every time the user types or selects a value it will be executed.

Text Filter

Example of default text filter

Text filter allows users to match string attributes based on these predefined criteria:

  • Contains
  • Starts with
  • Ends with
  • Greater than
  • Greater than or equal
  • Equal
  • Not equal
  • Smaller than
  • Smaller than or equal

You can select your filter criteria in the Text filter settings:

Text filter settings

When Adjustable by user is defined as No it will not render the option to choose the filter type in the widget.

Here is an example of available filter types for Text Filter:

Filter types for text filter

Here is an example of Text Filter with Adjustable by user set to No:

Example of text filter with “Adjustable by user” set as No

You can also define the default value of the widget, which will be predefined as initial value when opening your data grid page.

To have better control of when the filter will be applied, we offer a Apply after (ms) option under the On change behavior group. This option will only trigger the filter after a predefined period of time while typing. By default, Mendix suggests 500ms.

Configurations

In this section you can select a Saved attribute in order to save the current value of the filter. However, the value is not automatically applied to the widget. To restore the previously saved value of the filter, you must configure the same attribute as the Default value of the widget. The attribute available in this section must be one of the following types:

  • Hashed string
  • String

Events

In this section you can select an action to be executed On change by the filter value. This means every time the user types or selects a value it will be executed.

Grid Wide Filtering

In order to enable filtering within the data grid header (outside the columns) you need to enable Grid wide filters and select the desired attributes to be filtered in the Filtering tab. You can select attributes of the following types:

  • Autonumber
  • Boolean
  • Date & time
  • Decimal
  • Enumeration
  • Hashed string
  • Integer
  • Long
  • String

The attributes selected here will be used for the matching filter placed inside the composable region. Only the first keyword in the filter will be considered when filtering multiple attributes in grid wide filtering

When using multiple attributes, the filters will automatically select the matching attributes and then compose the desired filter value in an OR expression. Make sure you only have one filter widget for each type, for example Text Filter and Number Filter.

Export to Excel

The Data Grid 2 widget ships with built-in functionality to export data from the data source you configured in the settings. The export is done via the Export_To_Excel JavaScript action that is distributed as part of the Data Widgets module.

To export data from the data grid, create a new nanoflow that calls Export_To_Excel. The Export_To_Excel action has a set of inputs:

  • Datagrid name: the name of the data grid from which data should be exported (the name can be found and copied from the data grid's settings (Properties > Common > Name))
  • File name: the file name to use for the exported document (does not require an appended file extension)
  • Sheet name: the name to use for the Excel sheet of the exported document.
  • Include column names: a Boolean expression that, if true, tells the action to include column captions as the first row in the exported document
  • Chunk size: the number of rows fetched from the backend to the browser at a time.

Configuration

You can define an attribute to store the current configuration of the data grid. In this way, if you re-open your page then the current sorted columns, order, and hidden columns will remain the same as in the previous state. To set this option, you need to select a String attribute with Unlimited as its size as the attribute in the data grid Personalization tab in Studio Pro.

Here is an example of an unlimited string attribute:

Example of unlimited string attribute

In order to select an attribute, you need to surround the new Data grid with a Data view. This will allow you to select an attribute. You can also define an action when the attribute will be updated with the new configurations.

Here is an example of a configuration containing an On change action:

Example of a configuration containing on change action

Performance

The performance of the new data grid can be affected if sorting or filtering are enabled. This is because Data widgets v1.1 - 1.2 retrieve all available values for sorting or filtering while the widget runs. This problem does not occur in versions above 1.3 because those versions use Filtering APIs to retrieve only the necessary data.

Troubleshooting

If you are using Atlas v2.x and you cannot upgrade to Atlas 3 at the moment, please replace the line 3 cssFiles with the following code in the file theme/settings.json:

"cssFiles": [
    "styles/web/css/main.css",
    "theme.compiled.css"
],

In-Memory Selection

Enabling selection allows users to select a row by clicking the row or a checkbox. Selection is disabled by default, and can be activated by changing the Selection setting from None to either Single or Multi.

Since the data grid widget keeps selected items in short-living memory that is cleared every time you change the data grid page, selecting items across multiple pages is not supported. This means that the end-user can only select items that are currently visible.

Selection Mode

In Single selection mode, users are limited to selecting one row at a time.

In Multi mode, the user can select multiple rows.

Selection Method

When selection is enabled, you can choose a method for selecting rows. The Checkbox method adds a checkbox to the beginning of each row, and the end-user must click the checkbox to select the row. By contrast, the Row method does not add any additional controls to the row, and the end-user must click the row itself to select that row.

Show (Un)check All Toggle

If this setting is enabled, then the data grid widget shows a checkbox at the header. This checkbox controls the selection for all visible items. Clicking on this checkbox will select all visible items. If all items are already selected, clicking the checkbox clears the selection.

Selection and Row Click Action

The data grid settings support the case where it is possible to have both a selection and an on-click action at the same time.

The setting for action triggers is related to the selection method and can sometimes be ambiguous. See the table below to see which combinations of selection method and trigger are supported.

Selection method Action trigger Selection trigger Supported
Checkbox Single click on the row Click on the checkbox, Ctrl + click on the row (or Command + click on the row on Mac) Yes
Checkbox Double-click on the row Click on the checkbox, Ctrl + click on the row (or Command + click on the row on Mac) Yes
Row Single click on the row No
Row Double-click on the row Ctrl + click on the row (or Command + click on the row on Mac) Yes

To achieve this behavior, set the On click trigger to Double click. When a data grid is configured this way, the user may select a row by double-clicking it.

Keyboard Support

Key Function
Moves focus one cell to the right.
Moves focus one cell to the left.
Moves focus one cell down.
Moves focus one cell up.
Page up Moves focus one page up.
Page down Moves focus once page down.
Home Moves focus to the first cell in the row.
End Moves focus to the last cell in the row.
Ctrl + Home Moves focus to the first cell in grid.
Ctrl + End Moves focus to the last cell in grid.
Shift + Space Selects current row. (1)
Ctrl + A Select all visible rows. (1)(2)
Shift + / Moves focus and selects current and row above/below. (1)(2)
Shift + Page up/Page down Moves focus one page up/down and selects all rows between current and final row. (1)(2)
Shift + Home/End Moves focus to the start/end of the grid and selects all rows between current and final row. (1)(2)

Legend:

Symbol Meaning
1 Available only when selection is enabled.
2 Available only when selection mode should be Multi.

Resetting Filters

Resetting filters is possible using Reset_Filter and Reset_All_Filters actions available as part of the Data Widgets module. Setting up these actions is a manual process that requires creating a nanoflow and setting the name of the filter or data grid to be reset.

The name of the filter or data grid can be found at Properties > Common > Name.

Troubleshooting Runtime Errors

Filter Widget Errors

Error:

"The filter widget must be placed inside the column or header of the Data grid 2.0 or inside header of the Gallery widget."

  • Widget placement is incorrect.

Solution: Place widget inside Gallery header, Data Grid 2 header, or Data Grid 2 column.

Error:

"Unable to get filter store. Check parent widget configuration."

  • This error indicates that there is issue with widget settings. Most of the time this error happens when widget is placed in the header of Data Grid 2 or Gallery, but the Filter attributes setting is still set to Auto.

Solution: Switch widget attributes setting to Custom and configure the attribute for filtering.

Error:

"The [filter] is not compatible with [datatype] data type."

  • This error indicates that attribute configured in the Data Grid 2 for column is not compatible with current filter type.

Solution: Change filter to appropriate filter type. For example for string attributes use text filter.

"The attribute is not filterable. Please choose a different attribute."

  • This error indicates that it is not possible to use current attribute for filtering due to technical limitations.

Solution: Read and understand why some attributes are filterable and other are not. Change the model or choose another attribute.