AnsweredAssumed Answered

How to update the navigation/pathtree widget correctly?

Question asked by npavlov on Jun 7, 2018

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.

Outcomes