Adjustable flex datagrid row height for multi-level tree component
Note: This blog is extension to the post blogged here, the OP has used one level tree to display in grid, whereas I used multilevel tree.
From last 2-3 months I'm working on Flex, developing our in-house map editor. We've a requirement to show a grid with some column containing multilevel tree data, I googled it and found the above link which was matching to our requirement but got one problem, it didn't work correctly for multilevel tree. The problem is -
- It failed to adjust height when you expand inner child element.
- The whole tree get collapsed when you collapse the inner element.
To provide a solution to above problems, you have to -
- Keep a flag which tells if root is closing or not, if root is closing keep the original height.
- For all other child expansion, count the children from existing "open items" and adjust height accordingly.
The below code explains it all.