Tree Command¶
Use tree for generate html tags for tree. in fact, this command use in hierarchy data.
1 2 3 | <basis core="tree" nullvalue="" idcol="" parentidcol="" relationnamecol="">
[...]
</basis>
|
Important
The tree command inherit from Renderable Commands base class.
Attributes:¶
- nullvalue
stringoptional[##-notaion Determine null or empty value that determine root node on hierarchy. value of column
parentidcolin root record must be set tonullvalue. default value fornullvalueis0.- idcol
stringoptional[##-notaion Determine column name for primary-key or principal-key in data source that use for detect parent side of hierarchy relation. default value for
idcolisid.- parentidcol
stringoptional[##-notaion Determine column name for foreign-key in data source that use for detect child side of hierarchy relation. default value for
parentidcolisparentid.- relationnamecol
stringoptional[##-notaionobsoleted Determine column name in data source that use for sort hierarchy output. if not set, sorting is ignored.
Note
For see more Information about [##-notaion,see [## Notation
Example¶
1# Create simple command¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | <basis core="tree" datamembername="db.users" idcol="id" parentidcol="managerid" nullvalue="-1">
<layout>
<ul>
@child
</ul>
</layout>
<face level="1">
<li>
@lname :
<ul>
@child
</ul>
</li>
</face>
<face level="2">
<li>@fname - @lname</li>
</face>
</basis>
|
Data source db.users is:
id |
managerid |
fname |
lname |
team-name |
|---|---|---|---|---|
1 |
-1 |
s.alireza |
qamsari |
team-a |
2 |
1 |
amir |
jalali |
team-b |
3 |
1 |
akbar |
karimi |
team-a |
Result is:
1 2 3 4 5 6 7 8 9 | <ul>
<li>
qamsari :
<ul>
<li>amir - jalali</li>
<li>akbar - karimi</li>
</ul>
</li>
</ul>
|