How to properly change the name of a tree node in a custom tree?
Hi all,
I made my custom tree and it works perfectly. I'll explain the only issue I'm hitting:
My custom tree is just a subtree of umbraco Content tree. I wanted to display different name for some node than the original one, so I just changed the text property of a node (xNode.Text = "Custom_Name") and it displays fine. The problem is that after selecting (clicking) that particular node, it's name changes back to the original one as it is in Content tree.
Any idea how to change the name so it doesnt get back...?
Actually I want to be able to display different name for any other node in the tree (root node is fine). As I said above, I succeeded to to rename them, but after I select a node in the tree, the name gets back to original node name (as it is in Content tree).
So to get this straight, you've inherited from the loadContent tree and swapped out the loadContent tree for your new custom tree class in the umbracoAppTree table... It renders the nodes out correctly, but when you click on a node, the node text changes to what would have been originally rendered in the loadContent tree?
... Not sure if i fully understand. Is the above statement correct?
Ahh, ok. How are you setting the node's source property? Perhaps, the ajax request for the child nodes once your initial tree is loaded is querying for nodes from loadContent tree instead of your tree....
When you say you click on the node and the name changes, is that because when you click on the node the current tree branch refreshes?
Actually I am not sure if the whole tree branch "refreshes", but it certainly does not behave as when its reloaded by clicking "Reload nodes" action (so you a dial clock is displayed)
I think that its just the tree node that is somehow being "refreshed" so its name changes.
How to properly change the name of a tree node in a custom tree?
Hi all,
I made my custom tree and it works perfectly. I'll explain the only issue I'm hitting:
My custom tree is just a subtree of umbraco Content tree. I wanted to display different name for some node than the original one, so I just changed the text property of a node (xNode.Text = "Custom_Name") and it displays fine.
The problem is that after selecting (clicking) that particular node, it's name changes back to the original one as it is in Content tree.
Any idea how to change the name so it doesnt get back...?
Cheers!
Nikola
You mean you want to rename the root node, normally called 'content' to 'Custom_name'...?
The root node name for all trees is taken from the database umbracoAppTree alias depending on how many trees are being loaded in to the app.
Hi Shannon,
Actually I want to be able to display different name for any other node in the tree (root node is fine).
As I said above, I succeeded to to rename them, but after I select a node in the tree, the name gets back to original node name (as it is in Content tree).
Regards,
Nikola
So to get this straight, you've inherited from the loadContent tree and swapped out the loadContent tree for your new custom tree class in the umbracoAppTree table... It renders the nodes out correctly, but when you click on a node, the node text changes to what would have been originally rendered in the loadContent tree?
... Not sure if i fully understand. Is the above statement correct?
You got it right.
Except, I inherited from BaseTree instead from loadContent tree, so I get content nodes by
Document[] nodes = Document.GetChildrenForTree(root_id);
and then set their names manually.
Ahh, ok. How are you setting the node's source property? Perhaps, the ajax request for the child nodes once your initial tree is loaded is querying for nodes from loadContent tree instead of your tree....
When you say you click on the node and the name changes, is that because when you click on the node the current tree branch refreshes?
Actually I am not sure if the whole tree branch "refreshes", but it certainly does not behave as when its reloaded by clicking "Reload nodes" action (so you a dial clock is displayed)
I think that its just the tree node that is somehow being "refreshed" so its name changes.
is working on a reply...