cancel
Showing results for 
Search instead for 
Did you mean: 

How to update the navigation/pathtree widget correctly?

npavlov
Confirmed Champ
Confirmed Champ

Hi,

I have a tree of elements. When creating or deleting items, the tree is updated as it should, but when I change the name of the element, I want the element to be displayed with a new name in the tree. I tried to publish a topic similar to the case with the addition of a new element or the deletion of this one. When I edit name I see that the parent element of the tree collapses and unfolds, but the name doesn't change.

For example, I have such tree (using my custom ChildRequestPublishTopic). After changing the name of the element (for example named "sub222"), I want to reload its parent element and show the new name of the element.

For rendering the tree I use my custom widget that clones an "alfresco/navigation/PathTree" widget and subscribe to onCreate and onDelete:

this.alfSubscribe("MY_ITEM_CREATED", lang.hitch(this, this.onContentCreated));
this.alfSubscribe("MY_ITEM_DELETED", lang.hitch(this, this.onContentDeleted));

It works fine when I create a new tree item or delete one, but when I change the name of an item I try to publish "MY_ITEM_CREATED" or "MY_ITEM_DELETED" with payload, but it doesn't help. I can see that parent item (for example-"22") tries to refresh (collapses and expands), but the name doesn't change. In the log I can see that it has requested child items and got a correct new name of the item.

1 ACCEPTED ANSWER

npavlov
Confirmed Champ
Confirmed Champ

I have to modify function 

refreshTreeNode: function alfresco_navigation_PathTree__refreshTreeNode

and after collapse tree I add 

delete this.tree._itemNodesMap[treeNode.getIdentity()];

to delete its saved values.

View answer in original post

4 REPLIES 4

jpotts
World-Class Innovator
World-Class Innovator

Screenshots and sample code might make it easier for others to provide assistance with this.

npavlov
Confirmed Champ
Confirmed Champ

done

npavlov
Confirmed Champ
Confirmed Champ

I have to modify function 

refreshTreeNode: function alfresco_navigation_PathTree__refreshTreeNode

and after collapse tree I add 

delete this.tree._itemNodesMap[treeNode.getIdentity()];

to delete its saved values.

eliosn
Confirmed Champ
Confirmed Champ

How did you do to customize the icons?