I developed an application that populates a tree of hierarchical data in a database.
I designed it to use lazy loading, so it only gets child nodes when node expands.
My problem is that, obviously, I don’t know if node has children unless I call the database and look. Currently, I have implemented a dummy child element node, so that the [+] icon appears for all nodes, then I delete this node dummy and get real child nodes in the BeforeExpand event.
This means that I get the [+] icon for nodes that don’t have child nodes, so the user clicks the expand icon and nothing shows that looks a little crappy.
What is the preffrred method for handling child nodes in a lazy load tree? If I make a call to the database to find out if there are child nodes, could I just load the child nodes and forget about lazy loading?
It seemed to me that I had to store the "HasChildren" flag in the database, so I can selectively create my dummy child node only for nodes that actually have child nodes.
Sorry for the incoherent, I'm very interested to see what other people think ...
source share