I have a database table that has username, positionid,parentid fields. I have built a tree in PHP such that all the parent nodes load first. When a node is clicked, if it has children, then an ajax call is made to expand the node. Since expanding each node individually can becoming annoying, I was wondering if I can incorporate an "Expand All/ Collapse All" functionality to it. If the user clicks "Expand All", then all the ajax loads should happen simultaneously and the tree should expand.
How can I do this?