Tags:
create new tag
, view all tags
-- PedroRio - 16 May 2010

(xvw)ColumnAttribute Component

The (xvw)ColumnAttribute component is used as child of a GridPanel (or Bridge) 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. A SQL query can be also be executed per column to display a particular value.
ColumnAttribute text:
columnAttribute.PNG

XML Definition:

<xvw:columnAttribute 
   dataField='name' 
   ....

   label='Nome'
 >
</xvw:columnAttribute>

Properties

List of Properties of the ColumnAttribute component:

Property Description Type Possible Values Usage Default Value Example
dataField Name of the column of the DataListConnector / boObjectList, can also be used as alias to SQL columns String The name of an SQL from the sqlExpression property or the name of a file from the DataListConnector Required    
label The label to show in the table header column String / EL   Optional    
width The width of this column (in pixels) Int Any positive integer Optional*  

width='100'

* If you intend to use the export to PDF / Excel feature you need to set a valid (> 0) with for each column

See the GridPanel page for property forceColumnFitWidth and autoExpand on restrictions regarding column width

hidden If the column is hidden or not by default Boolean True / False Optional False  
resizable If the column size (width) can be changed by the user Boolean True / False Optional True  
sortable If the rows can be sorted by this column Boolean True / False Optional True  
groupable If the results can be grouped by this column Boolean True / False Optional True  
searchable If the results of the grid panel can be searched by this column Boolean True / False Optional True  
hideable If this column can be hidden (by the user) Boolean True / False Optional True  
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. Boolean True / False Optional False  
lookupViewer Force the lookup viewer name when searching by this column. String The name of a Lookupviewer Optional    
renderer An implementation of the netgest.bo.xwc.components.classic.GridColumnRenderer interface which allows the column attribute to rendered in a custom way EL ->GridColumnRenderer   Optional  

Must be binded to a bean renderer = '#{viewBean.myRenderer}'

CANNOT BE THE BOUI Column (or any other column that serves as the row identifier)

renderTemplate Render template, or JSON object with several render templates according to the value for this column. String   Optional    
sqlExpression Sql query to execute to retrieve the values of this column String   Optional    
wrapText Whether or not to wrap the text of column (usefull for columns of type LongText) Boolean True / False Optional False  
frozen Frozens a column (meaning it stays in the same place even when horizontal scrolling) - See notes Boolean True / False Optional False Only avaialable on the XEOJQUERY Grid implementation, not available on the default ExtJS Grid

Notes:

Columns that use SQL expressions can only be textual columns at the moment, Long, Date, etc... values are not yet implemented.

XML Definition in a Viewer

<xvw:gridPanel enableGroupBy='true' dataSource='#{viewBean.dataList}'>
    <xvw:columns>
        <xvw:columnAttribute width='100' dataField='BOUI'/>

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.
columnAttributeItalico.PNG

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.

Property - SQL Expression

A ColumnAttribute is declared with an SQL expression in the following way:

<xvw:columnAttribute width='150' label='Criador' 
         dataField='CRIADOR'
         renderTemplate="&lt;div style=\'color:red;font-weight:bold\'>%s&lt;/div>"
         sqlExpression="(select username from OiXEOUser where OTeste.CREATOR$=BOUI)"
      />

Declaring a SQL expression and formatting the output according to its value:

<xvw:gridPanel enableGroupBy='true' dataSource='#{viewBean.dataList}'>
   <xvw:columns>
      <xvw:columnAttribute width='150' label='Criador' 
         dataField='CRIADOR'
         renderTemplate="
            {
               'SYSUSER': '&lt;div style=\'color:red;font-weight:bold\'>%s&lt;/div>',
               '':'Null',
               'default': 'Other'
            }
         "
         sqlExpression="(select username from OiXEOUser where OTeste.CREATOR$=BOUI)"
      />

Predefined Constants to use in the dataField property _(can only be used when the the DataListConnector of the GridPanel component is an instance of XEOObjectListConnector - meaning that the Panel must be showing)_


Constant Description
SYS_OBJECT_ICON_16 Renders the Icon of the Object

SYS_OBJECT_LABEL

The label of the type of object (XEOModel)
SYS_ICON_COMPOSED_STATE TODO
SYS_CARDID The Card Id of the object
SYS_ROWNUM The number of the row
Topic attachments
I Attachment Action Size Date Who Comment
Unknown file formatPNG columnAttribute.PNG manage 0.8 K 2011-02-09 - 12:28 NicolauGrosskopf  
Unknown file formatPNG columnAttributeItalico.PNG manage 1.3 K 2011-02-09 - 13:42 NicolauGrosskopf  
Topic revision: r17 - 2016-06-07 - LuisFaisco
 

No permission to view TWiki.WebTopBar

This site is powered by the TWiki collaboration platform Powered by Perl

No permission to view TWiki.WebBottomBar