There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
TreeView implementation loads not really on demand
Looking at the menu I found the following issue:
The tree is supposed to load the child nodes of a parent node on demand. The code for this is utilized in the JS files and the Home Controller. However, the menu provider loads all nodes recursively. GetMenuRoot calls GetChildren which will call GetChildren
for every item, such creating a recursion. This is not a big problem with small structures but takes some time if the tree is used for something different than the menu.
I introducted a nullable boolean to ITVDataItem to idicate where a Node has children or not. In TVNodeRow and TVNode I chaeck if the property is set (hence the nullable). If that is the case, I use the flag to determine what kind of buttons to show, etc. If
the flag is null, I use the "old" logic which means checking the Items collection.
Probably not the best solution but it worked for me.
A problem with loading the nodes on demand occures, when the page is reloaded (F5). In this case, the nodes that have been loaded on demand do not exist. Only the root nodes are present. The TreeView Control expects the child nodes to be present. I solved this,
in storing the expanded nodes into the session and reloding all child nodes of the expanded nodes during a postback. I don't like having to store them my self because the tree already does this, but I haven't found a way to access that collection of expanded