Hello all,
I have an unbound UltraTree (v16.1) which is populated using the code below. This works well. Yet, my RAM piles up each time i populate the tree. I guess that the GC is not firing. Which is the right way to "clean" alle nodes off the tree to refill it with new data, using the same columnset as before? resetNodes or Nodes.Clear? According to help, both "remove all nodes".. but not from RAM?
Thanks
Martin
int intMinLevel = dstTreeBuilder.MyHierarchy.Min(r => r.cteLevel);
int intMaxLevel = dstTreeBuilder.MyHierarchy.Max(r => r.cteLevel);
utrMyHierarchy.BeginUpdate();
utrMyHierarchy.Nodes.Clear();
utrMyHierarchy.ResetNodes();
UltraTreeNode node;
//generate nodes by Level (first root, then children of root etc)
for (int intCurrentLevel = intMinLevel; intCurrentLevel <= intMaxLevel; intCurrentLevel++)
{
var CurrentLevelRows = dstTreeBuilder.MyHierarchy.Where(r => r.cteLevel == intCurrentLevel).OrderBy(r => r.ID);
foreach (var CurrentLevelRow in CurrentLevelRows)
node = new UltraTreeNode(CurrentLevelRow.ID.ToString(CultureInfo.InvariantCulture));
node.Override.ColumnSet = oColumnset;
foreach (UltraTreeNodeColumn col in oColumnset.Columns)
node.SetCellValue(col, CurrentLevelRow[col.Key]);
}
//Place Node in hierarchy
if (intCurrentLevel == intMinLevel)
//Root
utrMyHierarchy.Nodes.Add(node);
else
//Non-Root
UltraTreeNode parentNode = utrMyHierarchy.GetNodeByKey(CurrentLevelRow.F_Parent_ID.ToString(CultureInfo.InvariantCulture));
parentNode.Nodes.Add(node);
utrMyHierarchy.EndUpdate();
Hello,
Try calling Remove.
eg.
UltraTree.Nodes.Remove(node)
Are you assigning images to your nodes? It's possible some resources aren't getting cleaned up that the previous nodes were using.
thanks for your reply.
There are no images involved.
Removing nodes the way you suggest would need a level-based approach, removing the nodes in the deepest level first, then proceed upwards towards the root, right? I've assumed that one of the commands (Clear/ResetNodes) would have done this...
Regards