Adding a Grid Column
Use the Data Source Grid Definition dialog to add columns to your data source grid.
Implementation:
- Switch to the Definition tab.
- Double-click the grid you want to modify.
- Click Configure.
- Make sure you are viewing the grid's Definition panel.
- Click Add in the Data Source Grid Definition window.
- Use the first drop-down menu in the window to select a Column Type. The remaining fields in this window will depend to a large extent on the column type you select. The compatibility table below shows the fields available for each content type:
Column Type | Column Name | Column/Derived Expression | Format String | Grid Column Header | Custom Action | Action Link Label | Column Keyword |
None | ✓ | ✓ | ✓ | ||||
Label | ✓ | ✓ | ✓ | ✓ | |||
Text Box | ✓ | ✓ | ✓ | ||||
Link Button | ✓ | ✓ | ✓ | ||||
Image | ✓ | ✓ | ✓ | ||||
Visibility Expression | ✓ | ✓ | ✓ | ✓ | |||
Action Link | ✓ | ✓ | ✓ | ✓ | |||
Check Box | ✓ | ✓ | ✓ | ✓ | |||
Derived | ✓ | ✓ | ✓ | ✓ | |||
Mapped Text Box | ✓ | ✓ | ✓ |
- Add information into the Column Name drop-down menu. If the column type draws its data directly from the data source (Label, Link Button, Visibility Expression or Image), this field takes the form of a drop-down menu for picking which data source field you want the column to display. If the column type is anything else, this field will be represented by a text box. The value you enter into the text box has no effect on ActionLink, CheckBox or TextBox columns.
- (Label Only) Use the Format String field to add standard C# string formatting to the data displayed in the column, if applicable.
You can find out more about standard C# string formatting here.
- (Visibility Expression Only) Write an expression in the Column Expression field whose value is used to affect the column's visibility. As with other types of visibility expression, the column will only be visible if the expression evaluates to 1.
- (Derived Only) Write an expression in the Derived Expression field whose value is used when the grid loads.
- (Action Link and CheckBox Only) Use the Custom Action drop-down menu to select which of the actions in your model you want to trigger when the button or check box in this column is clicked. You will need to exit the Grid Definition interface to create actions if you have not already done so.
When you write a custom action to use in a data grid, you can include the Keyword of any of the grid's columns in your expression. The action will then use the column's value from the same row as the action being triggered.
- In the Grid Column Header field enter the text you want to appear at the top of the column. This can be left blank if you prefer.
Text written in this field for the LinkButton Column Type will appear as the link text, rather than the column header.
- In the Column Keyword field provide a keyword for the intended column. Assigning a column keyword makes its data available to expression attached to ActionLinks and CheckBox columns.
- (Optional, used in conjunction with the Column Keyword field). Tick the Show Model Variables check box if you have variables in your model, and you want the Column Keyword field to change to a drop-down menu, where you can use this to select an existing variable as the keyword of your column, instead of creating one for this purpose.
If you don't have any variables in your model, the Show Model Variables check box will be unavailable.
- Use the Column Order arrows to select a number, or manually type one yourself. This number will determine where the current column will appear in the grid, with 1 being the left-most column, followed by 2 and so on.
- (Optional) Tick the Allow User To Order This Column check box if you want the user to be able to change how the items are ordered, by clicking the column header.
- Click Save to close the window and return to the grid definition.
Repeat these steps if you want to add another column to your grid. You can add and configure as many columns as you want.