Table Row Handler
The table row handler will produce a row of data suitable for use in a table. Note: there is no TableHandler, you should use a TextHandler to produce the wrapper table and then use nested tags for the rows.
The handler is implemented by the TableRowHandler class and initialized via the XML Configured Processor.
For example:
Each "column" in the row should be separated by using the | character. Note: if you are using that character as one of the parser delimiters then it must be escaped. A future version of the table row handler will allow the column separator to be configurable.
You can specify a header row (i.e. one that has special formatting and is the "column headings" for the table) by setting option 1 to header. For example:
becomes:
It should also contain a headerItemWrapper element that is used for each column in a header, the value [[VALUE]] is replaced with the column value. The dataItemWrapper template will be used for normal data columns, the value [[VALUE]] is replaced with the column value.
Example:
Would produce:
The handler is implemented by the TableRowHandler class and initialized via the XML Configured Processor.
For example:
[table]
[tr]Hello World|Goodbye World[tr]
[table]
You can specify a header row (i.e. one that has special formatting and is the "column headings" for the table) by setting option 1 to header. For example:
[table]
[tr header]Name|Size[tr]
[tr]You|Large[tr]
[tr]Us|Small[tr]
[table]
Name | Size |
You | Large |
Us | Small |
Handler Options
The handler supports the following options:Name | Optional | Type | Description |
1 | Yes | string | Should be header. When provided on a row this will tell the handler that it is a header row rather than a "data" row. |
XML Initialization
The init element should contain a templates element that should then contain a rowWrapper element that is used to wrap the individual columns to produce a table row, the value [[VALUE]] is replaced with the data columns. It should also contain a headerItemWrapper element that is used for each column in a header, the value [[VALUE]] is replaced with the column value. The dataItemWrapper template will be used for normal data columns, the value [[VALUE]] is replaced with the column value.
Example:
<init> <templates> <rowWrapper><[CDATA[<tr>[[VALUE]]</tr>]]></rowWrapper> <headerItemWrapper><[CDATA[<td nowrap="nowrap" class="headerItem">[[VALUE]]</td>]]></headerItemWrapper> <dataItemWrapper><[CDATA[<td class="dataItem">[[VALUE]]</td>]]></dataItemWrapper> </templates> </init>
Example Usage
[table]
[tr header]Name|Size[tr]
[tr]You|Large[tr]
[tr]Us|Small[tr]
[table]
Name | Size |
You | Large |
Us | Small |