Hi,
It is hard to explain this issue but I will give it a shot.
I have some nodes like this that i build dynamically
All Items
Test1
Parts
Part1
Part2
Part3
A user can click on Part2 and delete. We call ActiveNode.Remove(). We then set the active node to the parent by saying Tree.ActiveNode to the Test1 node.
I collapse the Test1 Node.
On the before expand method we have a method that builds the child nodes. So the first thing it does is
e.TreeNode.Nodes.Clear();
Then I check for the existence of that Parts node. If it was not there for some reason we rebuild it (because if I was expanding from the root node it would not be there).
if(!e.Node.Exists("parts"))
{
UltraTreeNode n = e.Nodes.Add("parts");///ERROR
}
I get an error on that line that it already exists. But the exists returned false! Furthermore if i do this
UltraTreeNode n = treeView.GetNodeByKey("parts");
it returns a reference…but if you browse that object it is all screwy…for instance 'Parent' is null.
So I read somewhere that you have to call ActiveNode.Dispose()
http://ko.infragistics.com/community/forums/t/36985.aspx
I did this but it does not actually remove the node from the UI…stays on the screen. So to get around this after I remove the node I programatically collapse the parent node. This seems to fix the problem but I am not confident now that nodes are properly being disposed off. Plus it is bad for the user to have to expand the node to get back to the parts.
It is further weird because the node being removed is not the node giving us the trouble.
THanks,Mele
Yes still having this issue. Just got involved in some other projects.
I am in the tree's after expand...I want to refresh the child nodes underneath.
tree looks like:
Parent
Child
code looks like
Boolean b = e.TreeNode.Nodes.Exists("child");
//b evaluates false
if(!e.TreeNode.Nodes.Exists("child"))
e.TreeNode.Nodes.Add("child","child"); //FAILS WITH KEY ALREADY EXISTS
We are using 14.1.6.0
Thanks,
Mele
Hello Mele,
We are still following this forum thread.
Please feel free to let us know if you still have any questions on this matter.
Well, I can't imagine any situation in which what you are describing could happen - unless maybe you are using multiple threads and things are getting REALLY messed up and out of synch.
If you can reproduce the issue in a small sample, I could take a look. There are basically two ways to create a sample like that. One is to start with your real application and reduce it down to something we can run. The other is to start a new project and work upward toward the same situation as your real app. With something complex like this, I'd probably go with the first option.
e.Nodes actually..yes that is a typo!
It is not that is returning the wrong node…it is just returning a 'version' of that node that does not to seem to belong to the collection based on what I see when I inspect the object.
That is the code on the exists…it is taken from the even argument of the AfterExpand method of the tree.
This is a very large product so what is the best way I can show this to you guys? I pay for support so should I open a ticket? Would I be able to show someone on a goto meeting tip thing? I can maybe make a movie too and upload it?
Thanks,Mele