I am looking for component for tree representation of table field.
What I am looking for is table with columns but with option with collapsing of cell like tree.
I am looking for component for tree representation of table field.
What I am looking for is table with columns but with option with collapsing of cell like tree.
There is no built in Tree Table in Scout, but it is possible to make misuse the Table to make it look like a tree table. I just proposed an implementation in this Gist.
AbstractTreeTable
is a table template that adds 2 columns in the table:KeyColumn
: a primary key for the tableParentKeyColumn
: the key of the parent row or null if the row is at the tree root.AbstractTreeTable
handles the collapsed state or not of each node row. It also decorates the first column (indentation and[+]
&[-]
marker on the nodes). It handle the row action (execRowAction(..)
).If you use this in a table page, it is recommended to use a TablePageData and not
Object[][]
. If you use this in a table fields, it only works if the table field is using a bean based table data.My prototype could be improved:
Examples:
Of course, this is only a workaround for the real problem: scout is missing a representation for tree-tables at model level. If there was something like that, it would be possible to use real tree table widgets in the different UIs.