Overview
You can add a grid to a screen to display table data. The examples on this page refer to data for employees from various companies.
You can download the example data from the PhixFlow Learning Centre.
Creating a Simple Grid
On a screen canvas, to add a grid to display data:
- In the screen toolbar, click List Tables.
- Drag a table from the list and drop it onto the screen canvas.
- PhixFlow prompts you to choose how to display the data:
Click Grid. PhixFlow adds an empty grid. - The Available Attributes window appears, as shown in the animation below. Select attributes and drag them onto the empty grid.
PhixFlow adds the attributes as columns and populates the table with the records in the table. Click on the image below to see a larger version:
The appearance of the grid is set in the application properties → Style tab → Style Settings section.
Marking Columns as Editable
PhixFlow assumes that the data in a grid should not be editable by the application user, so sets the grid attributes to be read-only. If you want the application user to be able to edit the data in one of the grid columns:
- In the grid, click on the attribute column header to open its properties; see View Attribute.
In Properties tab → Grid Settings, untick Read Only.
The way an application user changes a cell value in a grid depends on the data type; see Understanding Data Types. The application user can:
- overtype a value for data that is a string, bigstring, integer, float or decimal
- select from a date-picker for dates and date/times
- select from a drop-down for an attribute that is set as the display name.
PhixFlow automatically updates the data record's unique identifier attribute to match the selected display name.
If an attribute is set as the display name, PhixFlow shows this attribute instead of a unique identifier; see Understanding ERDs and Attribute properties.
Autosaving Changes
When the application user makes a change to a cell in a grid, PhixFlow needs to save the change to the table. One option is to have a save button that the application user must click to save any changes; see Understanding Actionflows and Save Node.
Alternatively, allow PhixFlow to automatically save any changes that the application user makes. This change applies to the whole grid.
- In the grid, right-click to open the popup menu and select Show view to open the grid view properties.
- In Properties tab → Advanced, tick Auto Save.
Configuring Drop-Down Options
If you want to the application user to select from a set of values for a cell, add a drop-down using the view attribute properties Properties tab → Drop-down Settings; see View Attribute.
Reordering Columns
PhixFlow lists attributes from left to right in the header using the values in Basic Settings → Order. There are two ways to change the order in which the attributes are listed.
On the Grid
- In the screen canvas, drag a header and drop it in a different position in the header.
- PhixFlow changes Order value for all affected properties.
In the Properties
- In the grid, click on the attribute column header to open its properties; see View Attribute.
In Properties tab → Basic Settings → Order, change the number.
PhixFlow changes the Order value for all affected attributes.
Labelling Columns
By default, PhixFlow displays the attribute name as the column header. However, some attributes have technical names that make no sense to application users. In this case, you can add a different label to use in the header. You can also group columns under a shared header.
Adding Labels
To add a label that PhixFlow uses instead of the attribute name:
- In the grid, click on the attribute column header to open its properties.
- In Properties tab → Grid Settings → Label, add the text you want to appear in the column header.
Grouping Columns
If the data has related attributes, you can display the columns under a shared heading.
- In Basic Settings → Order, put the attributes next to each other in the grid.
- For each attribute, in Grid Settings → Label, specify a group heading using the form
Group, Specific
For example, in the Employees grid we have two name-related attributes next to each other:
First name | Last name |
---|
To change this to appear as:
Name | |
---|---|
First | Last |
- For the view attribute First name, set Label:
Name, First
- For the view attribute Last name, set Label:
Name, Last
The animation below shows how PhixFlow groups the adjacent columns using the group label.
Hiding Columns
Often your table requires attributes but the user does not need to see them. These attributes can contain
- codes or identifiers, such as the primary key
- data auditing information, such as the latest change to the attribute.
To hide attributes that do not need to appear in the grid:
- In the grid, click on the attribute column header to open its properties; see View Attribute.
In Properties tab → Grid Settings, tick Always Hidden.
You can also configure a column so that PhixFlow can show or hide it depending on a condition.
- In the grid, click on the attribute column header to open its properties; see View Attribute.
In Properties tab → Grid Settings → Hide if evaluates to True, add an expression. When the expression evaluates to:
false, PhixFlow displays the column
true, PhixFlow hides the column.
For example, you want to show a simplified grid for application users working on a mobile device, hide optional columns with a Hide if evaluates to True expression of: _client.mobile
Changing Column Widths
Depending on the defaults used for your grid, the columns may be set to resize automatically to take up a percentage of the available space.
On the Grid
- On the unlocked screen canvas, drag a column divider to the position you require.
- Lock the screen.
- PhixFlow saves the column widths to the attribute's Properties tab → Grid Settings → Grid Default Width (pixels).
In the Properties
- In the grid, click on the attribute column header to open its properties; see View Attribute.
In Properties tab → Grid Settings, to specify:
a minimum width, whilst allowing the column to stretch to fill the available space on larger screens, in Minimum Width specify a number.
For example, to prevent the column from shrinking below 100 pixels, specify100
.- fixed column width, in Grid Default Width (pixels), specify a number.
For example, to fix a column width to 100 pixels, specify100
(shown below).
Setting Grid Colours
Where your application uses the Serene Grey package template, grids are configured so that rows are automatically highlighted when the application user:
- hovers their mouse pointer over a row (highlight on-hover)
- clicks a row to select it.
There are different places where you can set styles; see Screen Styling.
Highlighting the Selected Row
The application user can click on a row to select it and it will be highlighted. To set or change the highlight settings for a selected row:
- Click the home button from the top menu and click Properties.
- In Style tab → Style Settings section → Row Selection Style, click Open Properties to open the style properties.
- If no style is set, click Add New to add one.
- Set the styling properties you wish to apply to selected rows in your grids. See Screen Styling.
- Common styles include:
- Font
- Background-color
- Common styles include:
Highlighting a Changed Row
To highlight a row when the application user changes a value:
- Click on the column header
- In view attribute properties → Grid Settings → tick Changes Row Colour.
- When the application user changes a value, PhixFlow automatically selects the row. The highlight persists until the application user clears the selection box at the start of the row.
Adding a Background Colour to a Row
The following allows us to set a row colour base on a value held within the row. This is recommended to be applied to specific rows.
- Right-click on a grid and select Show the View Configuration.
- Click on the Style tab
- Add a new style to Grid Row Style.
- Provide a name and click Save. This is necessary before we can add a CSS Property.
- In the CSS Properties section click
- CSS Tag,
background
- Expression, click on the slider to enable this.
- Value, set a condition for applying the style. For example, using the Employees data we will colour rows grey where the person's first name is Ewan.
if(_current.first_name == "Ewan", "grey")
- _current allows each row to check its value, and the value returned from our expression must be a string so we use quotes around the colour.
- CSS Tag,
Adding a Background Colour to a Column
To specify the background colour of a column, specify a Formatting Rule; see below.
Using Formatting Rules in Grids
PhixFlow formatting rules use and expression to determine the style or format to use depending on conditions; see Applying Formatting Rules. For example, the Companies table has a Status attribute. In a grid, you might want to display Approved companies in rows with a green background, but if the company is not approved it is displayed in a row with a red background.
To apply a formatting rule to a grid:
- In the grid, click on the attribute column header to open its properties; see View Attribute.
In Properties tab → Formatting Rules, click Add New to open the properties for a new formatting rule.
In Rule Expression, specify the condition; see Expression Basics and Expressions and PhixScripts. When this condition is true, PhixFlow applies the format. For example, to apply the style when the status is Approved, specify:
_current.Status == "Approved"
- In Style, select or add the style you want to use.
- Click OK. The animation below shows the Status column with a green background after the rule has been applied.
Changing Number and Date Formats
Your application has default formats for numbers and dates. If you want a different format for this grid, for example, to show a date of 01 Jan 2000 instead of 01/01/2000:
- In the grid, click on the attribute column header to open its properties; see View Attribute.
In Properties tab → Basic Settings → Table Attribute Details, select an alternative format for:
Number Format
Date/Time Format.
For how to create new formats, see Date Time Format and Number Format.
Learn More
- Filtering and Sorting Grids and Charts
- Formatting and Styling Grids and Charts
- Using Relational Views
- Actions on Grids and Charts
- Properties
This page is for application designers who want to display a grid of data on a screen.
Overview
You can add a grid to a screen to display table data. The examples on this page refer to data for employees from various companies.
You can download the example data from the PhixFlow Learning Centre.
Creating a Grid
On a screen canvas, to add a grid to display data:
- In the screen toolbar, click List Tables
- Drag a table from the list and drop it onto the screen canvas.
This example uses the Employees table. - PhixFlow prompts you to choose how to display the data:
Click Grid. PhixFlow adds an empty grid to the canvas. - PhixFlow displays the Available Attributes window, as shown in the animation below. Select attributes and drag them onto the empty grid.
PhixFlow adds the attributes as columns and populates the table with the records in the table.Click on the image below to see a larger version:
The appearance of the grid is set in the application properties → Style tab → Style Settings section.
Marking Columns as Editable
PhixFlow assumes that the data in a grid should not be editable by the application user, so sets the grid attributes to be read-only. If you want the application user to be able to edit the data in one of the grid columns:
- In the grid, click on the attribute column header to open its properties; see View Attribute.
In Properties tab → Grid Settings, untick Read Only.
The way an application user changes a cell value in a grid depends on the data type; see Understanding Data Types. The application user can:
- overtype a value for data that is a string, bigstring, integer, float or decimal
- select from a date-picker for dates and date/times
- select from a drop-down for an attribute that is set as the display name.
PhixFlow automatically updates the data record's unique identifier attribute to match the selected display name.
If an attribute is set as the display name, PhixFlow shows this attribute instead of a unique identifier; see Understanding ERDs and Attribute properties.
Autosaving Changes
When the application user makes a change to a cell in a grid, PhixFlow needs to save the change to the table. One option is to have a save button that application user must click to save any changes; see Understanding Actionflows and Save Node.
Alternatively, allow PhixFlow to automatically save any changes that the application user makes. This changes applies to the whole grid.
- In the grid, right-click to open the popup menu and select Show view to open the grid view properties.
- In Properties tab → Advanced, tick Auto Save.
Configuring Drop-Down Options
If you want to the application user to select from a set of values for a cell, add a drop-down using the view attribute properties Properties tab → Drop-down Settings; see View Attribute.
Reordering Columns
PhixFlow lists attributes from left to right in the header using the values in Basic Settings → Order. There are two ways to change the order in which the attributes are listed.
On the Grid
- In the screen canvas, drag a header and drop it in a different position in the header.
- PhixFlow changes Order value for all affected properties.
In the Properties
- In the grid, click on the attribute column header to open its properties; see View Attribute.
In Properties tab → Basic Settings → Order, change the number.
PhixFlow changes the Order value for all affected attributes.
Labelling Columns
By default, PhixFlow displays the attribute name as the column header. However, some attributes have technical names that make no sense to application users. In this case, you can add a different label to use in the header. You can also group columns under a shared header.
Adding Labels
To add a label that PhixFlow uses instead of the attribute name:
- In the grid, click on the attribute column header to open its properties.
- In Properties tab → Grid Settings → Label, add the text you want to appear in the column header.
Grouping Columns
If the data has related attributes, you can display the columns under a shared heading.
- In Basic Settings → Order, put the attributes next to each other in the grid.
- For each attribute, in Grid Settings → Label, specify a group heading using the form
Group, Specific
For example, in the Employees grid we have two name-related attributes next to each other:
First name | Last name |
---|
To change this to appear as:
Name | |
---|---|
First | Last |
- For the view attribute First name, set Label:
Name, First
- For the view attribute Last name, set Label:
Name, Last
The animation below shows how PhixFlow groups the adjacent columns using the group label.
Hiding Columns
Often your table requires attributes but the user does not need to seem them. These attributes can contain
- codes or identifiers, such as the primary key
- data auditing information, such as the latest change to the attribute.
To hide attributes that do not need to appear in the grid:
- In the grid, click on the attribute column header to open its properties; see View Attribute.
In Properties tab → Grid Settings, tick Always Hidden.
You can also configure a column so that PhixFlow can show or hide it depending on a condition.
- In the grid, click on the attribute column header to open its properties; see View Attribute.
In Properties tab → Grid Settings → Hide if evaluates to True, add an expression. When the expression evaluates to:
false, PhixFlow displays the column
true, PhixFlow hides the column.
For example, you want to show a simplified grid for application users working on a mobile device, hide optional columns with a Hide if evaluates to True expression of: _client.mobile
Changing Column Widths
Depending on the defaults used for your grid, the columns may be set to resize automatically to take up a percentage of the available space.
On the Grid
- On the unlocked screen canvas, drag a column divider to the position you require.
- Lock the screen.
- PhixFlow saves the column widths to the attribute's Properties tab → Grid Settings → Grid Default Width (pixels).
In the Properties
- In the grid, click on the attribute column header to open its properties; see View Attribute.
In Properties tab → Grid Settings, to specify:
a minimum width, whilst allowing the column to stretch to fill the available space on larger screens, in Minimum Width specify a number.
For example, to prevent the column from shrinking below 100 pixels, specify100
.- fixed column width, in Grid Default Width (pixels), specify a number.
For example, to fix a column width to 100 pixels, specify100
(shown below).
Setting Grid Colours
Where your application uses the Serene Grey package template, grids are configured to so that rows are automatically highlighted when the application user
- hovers their mouse pointer over a row (highlight on-hover)
- clicks a row to select it.
There are different places where you can set styles; see Screen Styling.
Highlighting the Selected Row
The application user can click on a row to select it. This ticks the selection box at the start of row. To clear the selection, the application user unticks the box.
To set or change the highlight colour for a selected row:
- In the repository, click on your application's name to open its properties.
- In Style tab → Style Settings section → Row Selection Style, click Open Properties to open the style properties.
If no style is set, click Add New to add one.
- Either select a Background Colour; see Style
Or go to the CSS Properties section, add a new CSS rule to specify abackground-colour
; see CSS Properties - Screen Styling.
To specify the background colour for parts of the grid...
Highlighting a Changed Row
To highlight a row when the application user changes a value , in view attribute properties → Grid Settings → tick Changes Row Colour.
When the application user changes a value, PhixFlow automatically selects the row. The highlight persists until the application user clears the selection box at the start of the row.
Adding Background Colour to a Column
To specify the background colour of a column, specify a Formatting Rule; see below.
Using Formatting Rules in Grids
PhixFlow formatting rules use and expression to determine the style or format to use depending on conditions; see Applying Formatting Rules. For example, the Companies table has a Status attribute. In a grid, you might want to display Approved companies in rows with a green background, but if the company is not approved it is displayed in a row with a red background.
To apply a formatting rule to a grid:
- In the grid, click on the attribute column header to open its properties; see View Attribute.
In Properties tab → Formatting Rules, click Add New to open the properties for a new formatting rule.
In Rule Expression, specify the condition; see Expression Basics and Expressions and PhixScripts. When this condition is true, PhixFlow applies the format. For example, to apply the style when the status is Approved, specify:
_current.Status == "Approved"
- In Style, select or add the style you want to use.
- Click OK. The animation below shows the Status column with a green background after the rule has been applied.
Changing Number and Date Formats
You application has default formats for numbers and dates. If you want a different format for this grid, for example, to show a date of 01 Jan 2000 instead of 01/01/2000:
- In the grid, click on the attribute column header to open its properties; see View Attribute.
In Properties tab → Basic Settings → Table Attribute Details, select an alternative format for:
Number Format
Date/Time Format.
For how to create new formats, see Date Time Format and Number Format.
Learn More
- Filtering and Sorting Grids and Charts
- Formatting and Styling Grids and Charts
- Using Relational Views
- Actions on Grids and Charts
- Properties