Template grid

6 minutes to read Download PDF Edit

The template grid shows a list of objects in a tile view. For example, a template grid can show a list of products. Using controls provided by the template grid you can browse, search and manipulate those objects. The template grid has a lot in common with the data grid. The main difference is that the objects are shown in templates (a sort of small data view) instead of rows.

Common properties

Name

The internal name of the widget. You can use this to give sensible names to widgets. The name property also appears in the generated HTML: the widget DOM element automatically includes the class ‘mx-name-{NAME}’, which can be useful for Selenium testing.

Class

The class property allows you to specify a cascading style sheet (CSS) class for the widget. This class will be applied to the widget in the browser and the widget will get the corresponding styling. The class should be a class from the theme that is used in the project. It overrules the default styling of the widget.

Note that the styling is applied in the following order: 1. Default styling defined by the theme the project uses. 2. The 'Class' property of the widget. 3. The 'Style' property of the widget.

Style

The style property allows you to specify additional CSS styling. If a class is also specified, this styling is applied after the class.

background-color:blue; This will result in a blue background

Tab index

The tab index influences the order in which the end user navigates through the page using the tab key. By default tab indices are zero and the tab order is determined automatically by the client system. A value of minus one (-1) means that the widget will be skipped when tabbing through the page.

Default value: 0

Components

Control bar

See Control Bar.

Search bar (for data source type ‘Database’ and ‘XPath’)

See Search Bar.

Sort bar (for data source type ‘Database’ and ‘XPath’)

See Sort Bar.

General properties

Show control bar

This property indicates whether the control bar will be visible in the end user interface. The control bar also includes the paging buttons.

Default value: True

Show paging buttons

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. Note that hiding the control bar also hides the paging buttons.

Default value: True

Number of rows

With this property you can change the number of rows of templates that will be shown on one page.

Default value: 3

Number of columns

With this property you can change the number of templates that will be shown next to each other in one row.

Default value: 2

Style template

The style template property allows you to choose from three different styling of the template grid. These stylings depend on your theme package.

Selection mode

The selection mode determines whether and how the user can select items in the grid.

Value Description
No selection The user cannot select items.
Single selection 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.

Default value: Single selection

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.

Default value: False

Default button trigger

The default button can be triggered by a single or a double click on a row.

Value Description
Single click A single click triggers the default button. This cannot be used in combination with allowing the user to select rows.
Double click A double click triggers the default button.

Default value: Double click

Refresh time (in seconds)

If the refresh time is non-zero, the template 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.

Default value: 0

Data source properties

The data source determines which objects will be shown in the template grid. For general information about data sources, see Data Sources.

Type

The template grid supports the following types of data sources: Database Source, Association Source, Microflow Source. The database source retrieves objects from the database and supports searching and sorting. The association source follows an association from the enclosing data view to get to the objects. Finally, the microflow source calculates the list of objects by executing a microflow.

Other properties

See the corresponding data source for its properties:

Visibility properties

Visible

By default, whether or not an element is displayed in the browser is determined by how the page is designed and the user’s roles within the application. However, the page can be configured to hide the element unless a certain condition is met.

Attribute Condition

Attribute

When checked, this setting hides the widget unless a particular attribute has a certain value. Only boolean and enumeration attributes can be assigned to this purpose.

A practical example would be a web shop in which the user must submit both billing and delivery information. In this case you might not wish to bother the user with a second set of address input fields unless he or she indicates that the billing and delivery address are not the same. You can accomplish this by making the delivery address fields conditionally visible based on the boolean attribute SameBillingAndDeliveryAddress.

Module roles

The widget can be made visible to a subset of the user roles available in your application. When activated, this setting will render the widget invisible to all users that are not linked to one of the selected user roles. Please note that this does not override project security. Any restrictions due to microflow, form, or entity access will remain in effect.