Adobe-Consulting-Services / acs-aem-commons

http://adobe-consulting-services.github.io/acs-aem-commons/
Apache License 2.0
451 stars 597 forks source link

Refresh Hierarchy Parent #198

Closed gtxorb closed 7 years ago

gtxorb commented 10 years ago

This is piece of js to refresh component's parent component. This is for author using in edit view. It is provided a friendly user experience to author especially in a heavy page. There is a case that when author create the content, he usually drags a container first then the component itself, but after the author edit or delete the component the container can't be refreshed. It is common to refresh page, but it cost to much when the page is big. So refresh hierarchy parent is more helpful. It is used in cq:listeners afterdelete or afteredit etc, given a parameter for which level should be refreshed.

cwoeltge commented 10 years ago

I might miss something but have you looked at existing REFRESH_PARENT config option? http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/wcm/api/components/EditConfig.html#REFRESH_PARENT

gtxorb commented 10 years ago

This may not only refresh the parent component itself, but can also refresh the container in any level.

davidjgonzalez commented 10 years ago

@gtxorb Can you expound on "but can also refresh the container in any level." ? Whats an example use case?

gtxorb commented 10 years ago

@davidjgonzalez Sorry for the late reply. You can regard this as an enhancement of REFRESH_PARENT. Sometimes this.getParent() can not find the valid object so return the result of refresh page. This enhancement just look for the path and find which one should be refreshed.

davidjgonzalez commented 10 years ago

@gtxorb "Sometimes this.getParent() can not find the valid object so return the result of refresh page." -- can you give an example of when this happens?

gtxorb commented 10 years ago

@davidjgonzalez Sorry, I lead you to the wrong direction. I mean in REFRESH_PARENT it just find parent up to one level. When there is more then 3 levels, you can not refresh the first level component by the method in the inner component. Like the table with dynamic adding row function, each row should be a individual component, and it may contains some others in the items. Or like some complex carousel with components in each item.

cgeyma commented 7 years ago

This is piece of js to refresh component's parent component.

please let me know where this piece of JS is. Thanks.