NAME
RapidApp::Module::AppDV::HtmlTable - Table generator for RapidApp/AppDV
DESCRIPTION
This module generates a nicely laid out "Property" (name/value pairs) HTML table according to the data structure in 'tt_table_data' which should look like this:
[
[
{
name
=>
"Some Label/Heading"
,
value
=>
"Some value"
},
{
name
=>
"foo"
,
value
=>
"BLAH"
},
{
name
=>
"abc"
,
value
=>
"xyc"
},
],
[
{
name
=>
"Some Label, top of second column group"
,
value
=>
"Some value"
},
{
name
=>
"aaa"
,
value
=>
"123"
}
]
]
The data should be an array of arrays, each sequential sub array defines a column set and contains name/value pairs
While you can manually define tt_table_data, if you don't it will be automatically populated according to the configured DataStore2 columns.
By default 2 even column sets will be setup, but you can define 'column_layout' which is an intermediary for generating tt_table_data like this:
has
'+column_layout'
, =>
default
=>
sub
{[
[
'column_name1'
,
'col_foo'
,
'another_column'
],
[
'col_a'
,
'col_b'
],
[
'col_z'
,
'col_y'
,
'col_x'
,
'col_w'
]
]};
The above would define 3 column groups. The headers and AppDV 'autofield' values are populated automatically according to the DataStore2/TableSpec column configs
You can also apply extra css styles like this:
has
'+tt_css_styles'
,
default
=>
sub
{{
'table.property-table table.column td.name'
=> {
'text-align'
=>
'right'
}
}};
The above would cause the labels to the right-justified instead of left-justified. This is based on the css and class names that are used when the table is generated. See the tt file (rapidapp/misc/property_table.tt) for direction on what css styles to apply
You can also override the method 'get_tt_column_data' for fine-grained control when tt_table_data is being automatically generated from DataStore2 columns
Besides 'name' and 'value', other column_data parameters are available:
* name_cls:
if
supplied, this css class name is applied to the name cell div
* value_cls:
if
supplied, this css class name is applied to the value cell div
* name_style:
if
supplied, this style is applied to the name cell div
* value_style:
if
supplied, this style is applied to the value cell div
* whole_col:
if
set to true,
'name'
is ignored and colspan=
"2"
is set on the
'value'
cell/td
The column data hash can be returned from get_tt_column_data, and arbitrary also column_data hashed can be supplied instead of a column name within 'column_layout'
AUTHOR
Henry Van Styn <vanstyn@intellitree.com>