--
PedroRio - 16 May 2010
The
ColumnAttribute component is used as child of a
GridPanel (or
BridgePanel) component in order to select which columns should appear. By default
GridPanel instances will show a selection of the attributes of the objects used in the data source. With the
ColumnAttribute component the exact number (and which) of attributes can be selected.
XML Definition:
<xvw:columnAttribute
dataField='name'
....
label='Nome'
>
</xvw:columnAttribute>
Properties
List of Properties of the
ColumnAttribute component:
Property |
Description |
Requirement |
Default Value |
Type |
Note |
dataField |
The attribute from the object to be shown, since ColumnAttribute is a child of Bridge or GridPanel one the attributes from the list of objects they contain can be selected into a column |
Required |
|
String |
|
label |
The label to show in the table header column |
Optional |
|
String |
|
width |
The width of this column (in pixels) |
Optional |
|
Number |
|
hidden |
If the column is hidden or not |
Optional |
False |
Boolean |
|
resizable |
If the column size can be changed |
Optional |
True |
Boolean |
|
sortable |
If the rows can be sorted by the current column |
Optional |
True |
Boolean |
|
searchable |
If the results of the grid panel can be searched by this column |
Optional |
True |
Boolean |
|
hideable |
If this column can be hidden |
Optional |
True |
Boolean |
|
contentHtml |
Marks the content of the column as HTML, this is used when exporting the column values to another format (excel, pdf) and it marks that the content is HTML (or not) and will be converted to final format knowing this. |
Optional |
False |
Boolean |
|
lookupViewer |
Force the lookup viewer name when searching by this column. |
Optional |
|
String |
|
renderder |
An implementation of the netgest.bo.xwc.components.classic.GridColumnRenderer interface which allows the column attribute to rendered in a custom way (must |
Optional |
|
GridColumnRenderer |
Must be binded to a bean renderer = '#{viewBean.myRenderer}' |
Property - Renderer:
The renderer property allows the developer to custom render a given column attribute.
If one would want to display the value of the column in italic the following should be done.
XML Definition
<xvw:columnAttribute dataField='myFields' renderer='#{viewBean.myRenderer}'>
Java Bean Code
public GridColumnRenderer getMyRenderer() {
return new GridColumnRenderer() {
public String render( GridPanel grid, DataRecordConnector record, DataFieldConnector field ) {
String oValue = field.getValue();
return "<i>" + oValue + "</i>";
}
}
}
Notes: A
DataRecordConnector represents the line form the current Grid and the
DataFieldConnector represents the field from the current line.