Expertsystemen

 

Dynamic columns

This article describes the possibility to hide some of the columns defined in the grid. This way, you can show different columns to the user, depending on what you want. For example, if the user has said there was partner, you can show the column ‘income partner’, but if there is no partner, you can hide that column.

To tell the grid there are dynamic columns involved, you need to create a dataset of the same type the grid uses. Per column, so per data, you can set a 1 for visible or 0 for invisible.

In this example, there is a dataset with two variables, mydataset.data.name and mydataset.data.second. The name of that dataset is dynamicgrid. For dynamic columns, a second dataset is required, of the same type. In this example this dataset is called visiblecolumns, created in the same node.

To make sure visiblecolumns has the right data, simply set 1 (visible) or 0 (invisible) in the corresponding columns. Like this:

setting the visibility of a column
setting the visibility of a column

Off course, this will always show the two columns, you can change this by using conditions, or just take the value from another data.

When editing the grid with the dataset dynamicgrid, we can check the ‘Dynamic columns’, and select the dataset visiblecolumns.

using dynamic columns
using dynamic columns