Description: A Grid column. Defines the columns that will be read by the container grid component.
JavaDoc: Click here
Remarks: The data for each colum will be accessed using JavaBean notation. If an attribute is "someAttribute", the resulting field will have it's value read through the following method invocation "object.getSomeAttribute()".
If all fields are to be displayed then we need not specify the Column component. By default the Grid component will infer all possible columns.
For combo editing fields see the comboField component to see how to create the inner combo options.
Body content: Empty. All enclosed content will be ignored.
Attributes:
Name | Description | Data type | Required | Default value |
attribute | The name of the attribute. See above. | String | No | - |
title | The title for the column | String | No | The attribute name interpreted as camel case. (i.e. "someAttribute" would become "Some Attribute") |
sortable | Allows sorting for this column or not. | Boolean | No | True |
forceUnmodifiedUpdate | Always sends the field in update AJAX requests. | Boolean | No | False |
hidden | Hides this column from the grid by default. Can still be shown by the user. | Boolean | No | False |
readonly | Prevents editing for this column. IN DEVELOPMENT!!! | Boolean | No | False |
type | Define the type of this column. | String | No | Auto |
optionsAjaxEvent | Defines the option list for a Combo for editing purposes. | String | No | - |
urlLabel | Define the label for url type columns. | String | No | Auto |
urlFormat | Optionally override the url column rendering. | String | No | Auto |
width | Specify the width of the column. | Integer | No | Auto |
wordWrap | If the column should wrap it's text | Boolean | No | False |
summary | A summary row column info. ("max", "min", count or "sum") | String | No | - |
summaryFormat | The format for the summary row cell. (use $1 for the value. Ex. "$1 records") | String | No | - |
align | Sets de column align. ("center","right","left") | String | No | - |
Column type values: Available types:
If the urlFormat attribute is specified it will define how the column content will be rendered.
The content must follow the notation url|text and will result in a href="url" alt="text">text</a \
The content will be parsed for substitution variables in the following syntax:
http://www.digitalis.pt/dif2/servlet?id=$[id]|Link to $[name] \
The attribute and urlLabel will be available through the substitution variables value and label respectively.
All fields can be inserted through an equally named substitution variable.
The attribute optionsAjaxEvent can define parameters to be used in the ajax event request. To enable this just add to the optionsAjaxEvent content the parameter name, like a regular URL, followed the column name where to fetch the data. The column name must be start with "$[" and finish with "]". If the data has a description to relate the code, this can be define by "|" character follow by the column name to retrieve the data description. The referred columns must be declare has normal column, use the "hidden" attribute if the information isn't relevant.
The ID of these columns will be automatically generated, unless an attribute parameter is also provided. []
Examples:
View - JSP file
<dif:document> <dif:grid id="grid" title="Grid Sample" data="${stage.services}" noDataMessage="No services exist!" groupColumn="providerName"> <dif:column attribute="providerName" /> <dif:column attribute="applicationName" /> <dif:column attribute="ID" title="ID" /> <dif:column attribute="name" /> <dif:column attribute="stageCount" /> <dif:column attribute="registered" sortable="false" /> </dif:grid> </dif:document>
Stage - Class file
public class SomeStage { (...) @ProviderList List<IProvider> providers; public List<ServiceRecord> getServices() { List<ServiceRecord> services = new ArrayList<ServiceRecord>(); for (IProvider provider: providers) for (IApplication application: provider.getApplications().values()) for (IService service: application.getServices().values()) services.add(new ServiceRecord(service)); return services; } }
Screenshots:
See also: