Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
635
Showing/hiding treenodes using the Visible property is slow
posted

Hello all,

I've got a UltraWinTree with about 3200 nodes in it. I need to hide some nodes if a condition is met. What I do is:

BeginUpdate();

Start recursion;

if (conditionMet){ ultraTreeNode.visible = false; }

End recursion;

EndUpdate();

What I've found is that it takes ~3.2 seconds to peform this operation if the tree is expanded and ~1.6 seconds if the tree is collapsed. The code has been optimized to set modify only the nodes that are necessary; if a node is hidden, I don't check its child nodes.

Am I doing something wrong, or is this performance typical? Thanks.

Parents
  • 469350
    Suggested Answer
    Offline posted

    Hi,

    Is your tree bound to a data source? Or are you filling it manually?

    If it's bound, then this makes sense, because the tree loads the data lazily. So looping through every node will force the child nodes to get loaded and loading data from the data source can slow things down (depending on the data source). If that's the case, then the delay would only happen the first time. The second time, the data would already be loaded.

    In that case, what I would recommend is that you do not loop through the node. Instead, use the InitializeDataNode event to hide the nodes. That way, only nodes that are expanded will be processed, and you will avoid loading the hidden nodes unnecessarily.

     

Reply Children