In a
<tree class="formwidget"
the treecol
holds the name of the query, the treecells holds the value.
When harvesting, the tree object loops all selected treeitems
and adds a seed for every cell that is in a
<treecol class="formwidget"
.
Nothing extra is defined on the treecell in xbl,
because the treecell tag doesn't really exist in xul.
When seeding, all containers in the tree are opened first.
if a name/value pair matches a single treecell, the whole row
is selected.
The "value" of a treecell is taken to be either view.getCellValue,
or a
value
attribute on the tree cell (for contentview trees), or
the view.getCellText of the cell, in that order. The label is taken
to be the view.getCellText.
For multiple select trees, the
<treecol class="formwidget index"
has a special meaning. If it exists, it's selected row's value is
appended to the name of every other
<treecol class="formwidget"
in the same row. As a result, rows
can be grouped on the receiving side, which is usefull
for multiple select trees. remember the order of cgi variables
is not guaranteed by the spec.
Note: In XUL, once a treerow is selected, it's impossible to undo the
selection and select 'nothing'. You might want to add your own 'select none'
button somewhere.
Note2: when seeding, if a single cell matches the whole row is selected;
this could also erronuously select some other treecell in the same row.
A single, "ID" kind of treecol should be enough to identify the whole row.
Example:
result:
who=joe & what=1 [ & what.label=sex ] or
who=joe & what_joe=1 [ & what_joe.label=sex ]
Additional Attributes:
-
tree[onvalidate]
pseudo event handler. should point to a method to execute
for validation. when validating, the method will receive a bucket
with seeds in it, reflecting the keys, values and labels of the
selected treecells.
-
tree[indexseparator]
the separator used to prepend the value of the indexcolumn cell
to the name of the column, default "__"
treecol[name]
The name of the column. Used as the name (or key) of the variable in CGI
treecell[value]
Not really defined in XBL. checked anyway.
Additional Properties:
-
selectedRowIndexes
readonly. returns array of indexes of selected rows
-
indexColumn
readonly. returns the xul element of the indexcolumn or null
Additional Methods:
-
harvest()
See harvest and seed
-
seed()
See harvest and seed
-
validate()
executes the method specified in onvalidate
-
getCellNode(rowidx,columnxulelm)
returns the treecell element for contentviews,
null on failure.
-
toggleOpenStates(open)
when open==true, opens all containers nodes
else closes all container nodes