For the Simplified Chinese translation, click 中文译文.
shows a list of objects in a table format. For example, a data grid can show customer’s name, grade, and all the orders a customer has placed:
Using controls provided by the data grid you can browse, search, and edit those objects.
A data grid contains the following components:
- Search bar – allows end-users to search for objects in the data grid
- Control bar – allows you to control the objects displayed in the data grid by means of buttons
- Sort bar – allows end-users to sort items in the data grid
- Grid Columns – allows end-users to set properties for a data grid column
An example of data grid properties is represented in the image below:
Data grid properties consist of the following sections:
3.1 Common Section
For more information on properties in this section, see the Common Section section in Properties Common in the Page Editor.
3.2 Data Source Section
The data source determines which objects will be shown in a list view. For general information on data sources, see Data Sources.
The list view supports the following types of data sources:
- Database source – objects are retrieved directly form the database. The database source can be used in offline applications.
- XPath source – objects are retrieved directly form the database
- Microflow source – calculates the list of objects by executing a microflow
- Association source – follows an association to get to objects
The database and XPath sources retrieve objects from the database and supports searching and sorting.
3.3 Design Properties Section
The Design Properties allow you to change spacing and alignment of the widget and hide it on phone, tablet, or desktop, if needed. Design properties may vary depending on the type of the widget. For example, for the text widget you can change its font weight, color, alignment, and letter case.
3.4 General Section
3.4.1 Show Control Bar Buttons
This property indicates whether the control bar buttons will be visible in the end-user interface.
Even if the control bar buttons are invisible, there can still be a default button that is triggered by (double) clicking a row. For more information, see the property Default Button Trigger and Control Bar.
3.4.2 Show Paging Buttons
This property is not available in Mendix 8.13 and above. Use the Show Paging Bar property instead.
This property indicates with the buttons to page through the information in the grid are visible. Only hide these buttons if you are sure that there will never be more objects than the number of rows of the grid.
3.4.3 Show Paging Bar
This property was introduced in Mendix 8.13. It replaces the Show Paging Buttons property.
With this property, you can change the way the paging bar is shown.
|Yes (with total count)||The paging bar is shown, including the Go to last page button and the total count of objects.|
|Yes (without total count)||The paging bar is shown (except for the Go to last page button). Also, the total count of objects is not shown, as page numbers are shown instead.|
|No||The paging buttons are not shown.|
Default: Yes (with total count)
Hiding the control bar also hides the paging buttons. For details, see Show Control Bar Buttons.
3.4.4 Number of Rows
With this property you can change the number of rows that will be shown in one page. See also the property ‘Show empty rows’.
3.4.5 Show Empty Rows
If you choose to show empty rows there will always be the grid will always show the same number of rows (see ‘Number of rows’) even if there are less objects to show on the page.
3.4.6 Selection Mode
The selection mode determines whether and how the user can select items in the grid.
|No selection||The user cannot select items.|
|Single selection (default)||The user can select a single item by clicking on it. Clicking another item will make that item the selection.|
|Single selection and maintain||The user can select one item at a time by clicking on it. Users cannot deselect an item. By default the first item will be selected and removing a selected item will autoselect a subsequent item.|
|Multi-selection||The user can select multiple items by clicking the first one and holding the ‘Ctrl’ key while clicking on other items. Simply clicking an item will deselect all items and make the clicked item the selection.|
|Simple multi-selection||The user can select multiple items by simply clicking on them.|
3.4.7 Select First
This property indicates whether the first item will be selected initially. This is especially useful if there is a data view listening to this grid.
3.4.8 Default Button Trigger
The default button can be triggered by a single or a double click a row.
|Single click||A single click triggers the default button. This cannot be used in combination with allowing the user to select rows.|
|Double click (default)||A double click triggers the default button.|
3.4.9 Refresh Time (in Seconds)
If the refresh time is non-zero, the data grid will refresh its contents every given number of seconds. For example, a task list could be refreshed every minute so that you know when new tasks arrive. By default the refresh time is zero and this means that the grid will not automatically refresh itself.
3.4.10 Tooltip Page
A tooltip page is a page that appears when you hover your mouse over a row. The tooltip page should consist of a data view on the same entity as the data grid. Besides creating and connecting a tooltip page you also have to specify on which columns the tooltip will appear. See the property ‘Show tooltip’ of data grid columns.
3.5 Visibility Section
Visibility determines whether a widget is displayed to the end-user as part of the page.
For more information on properties of this section, see the Visibility Section section in Properties Common in the Page Editor.
4 Performing Specific Actions
To perform actions on a data grid, select it on a page and right-click it. The list of possible actions opens. While some actions from this list, such as Select data source, Edit condition for visible, are a quick way to set the properties, the following actions are specific actions that you can perform:
- Go to entity – opens a domain model and highlights an an entity that is used as the data source
- Go to data source microflow – this action is only displayed when a microflow is set as the data source and opens this microflow
- Go to tooltip page – opens a page select as the tooltip page in properties