Double Folding for Trees
Shows how trees can be enriched with a second expand-control.
One expands just the folder, the other expands the folder and all its sub-folders recursively.
Use the bigger traditional expand-control to expand / collapse just the current folder.
Use the smaller new expand-control to expand / collapse the tree fully.
Mind that the small control nicely indicates the presence of sub-folders!
I have also written a
Blog
about this.
First Tree (small, initially expanded, expand-all control is right)
- item 1
- item 1.1
- item 1.2
- item 1.3
- item 1.3.1
- item 1.3.2
- item 1.3.3
- item 1.4
- item 2
Second Tree (big, initially collapsed, expand-all control is left)
- root
- item 1
- item 1.1
- item 1.2
- item 1.3
- item 1.4
- item 1.5
- item 2
- item 3
- item 3.1
- item 3.1.1
- item 3.1.2
- item 3.1.3
- item 3.1.4
- item 3.1.5
- item 3.1.6
- item 3.2
- item 3.3
- item 3.3.1
- item 3.3.2
- item 3.3.3
- item 3.3.3.1
- item 3.3.3.2
- item 3.3.3.3
- item 3.3.3.4
- item 3.3.3.5
- item 3.3.3.6
- item 3.3.3.7
- item 3.4
- item 4
- item 4.1
- item 4.2
- item 4.3
- item 4.4
Test Cases
Refresh the browser page before each test sequence.
In First Tree, ...
- click on small expand-control of item 1 to collapse the whole tree
- click on small expand-control of item 1 to expand it fully
Expected: all items are expanded, and all controls point down.
- click on small expand-control of item 1 to collapse the whole tree
- click on big expand-control of item 1 to expand just the root folder
Expected: just the root folder is expanded,
the small expand-control on root points right, indicating collapsed sub-folders.
- click on small expand-control of item 1 to collapse the whole tree
- click on big expand-control of item 1 to expand just the root folder
Expected: item 1.3 is collapsed.
- click on (big) expand-control of item 1.3 to collapse it
- click on big expand-control of item 1 to collapse it
- click on small expand-control of item 1 to expand it fully
Expected: all items are expanded, and all controls point down.
In Second Tree, ...
- click on big expand-control of root to expand just the root folder
Expected: just the root folder is expanded,
the small expand-control on root points right, indicating collapsed sub-folders.
- click on big expand-control of root to expand just the root folder
- click on big expand-control of item 3 to expand just that folder
- click on small expand-control of item 3.3 to expand it fully
- click on small expand-control of item 3 to expand it fully
Expected: all items are expanded, and their controls point down,
except item 1 and item 4.
Known Bugs
- click on small expand-control of root to expand the tree fully
- collapse all folders below the root folder
Expected: the expand-all control on root folder is pointing right,
indicating that not all sub-folders are expanded.
Result: the expand-all control on root folder is still pointing down,
indicating that all sub-folders are expanded, but some are collapsed.
This is because tree-nodes do not communicate with nodes above them.
ɔ⃝ Fritz Ritzberger, 2017-08-18