19.6. Cells
Cells are nested within columns (for iteration) or inside worksheets (for direct placement using the
column and row attributes) and are responsible for outputting the value, usually through an EL-expression involving the var attribute of the datatable. See Section 19.14.6, “Cell settings”.
<e:cell>
|
Attributes
Child elements
Facets
|
<e:workbook> <e:worksheet> <e:column value="#{personList}" var="person"> <f:facet name="header"> <e:cell value="Last name"/> </f:facet> <e:cell value="#{person.lastName}"/> </e:column> </e:worksheet> </e:workbook>
This defines a column with a header and an iterated output.
19.6.1. Validation
Validations are nested inside cells or formulas. They add constraints to cell data.
<e:numericValidation>
|
Attributes
Child elements
Facets
|
<e:workbook> <e:worksheet> <e:column value="#{personList}" var="person"> <e:cell value="#{person.age"> <e:numericValidation condition="between" value="4" value2="18"/> </e:cell> </e:column> </e:worksheet> </e:workbook>
This adds numeric validation to a cell, specifying that the value must be between 4 and 18.
<e:rangeValidation>
|
Attributes
Child elements
Facets
|
<e:workbook> <e:worksheet> <e:column value="#{personList}" var="person"> <e:cell value="#{person.position"> <e:rangeValidation startColumn="0" startRow="0" endColumn="0" endRow="10"/> </e:cell> </e:column> </e:worksheet> </e:workbook>
This adds validation to a cell, specifying that the value must exist within the values specified in range A1:A10.
<e:listValidation>
|
Attributes
Child elements
Facets
|
e:listValidation is a just a container for holding multiple e:listValidationItem tags.
<e:listValidationItem>
|
Attributes
Child elements
Facets
|
<e:workbook> <e:worksheet> <e:column value="#{personList}" var="person"> <e:cell value="#{person.position"> <e:listValidation> <e:listValidationItem value="manager"/> <e:listValidationItem value="employee"/> </e:listValidation> </e:cell> </e:column> </e:worksheet> </e:workbook>
This adds validation to a cell, specifying that the value must be "manager" or "employee".
19.6.2. Format masks
Format masks are defined in the
mask attribute in a cell or formula. There are two types of format masks: one for numbers, and one for dates.
19.6.2.1. Number masks
When a format mask is encountered, a check is executed to see if the mask follows an internal form, for example,
format1, accounting_float, etc.
If the mask is not part of the internal list, it is treated as a custom mask (for example,
0.00), and automatically converted to the closest match.
19.6.2.2. Date masks
When a format mask is encountered, a check is executed to see if the mask follows an internal form, for example,
format1, format2, etc.
If the mask is not part of the internal list, it is treated as a custom mask (for example,
dd.MM.yyyy), and automatically converted to the closest match.