AEM CQ:Listeners Node For A Component

There are many times when an author is modifying a component on a page, and they will have to manually refresh the page in order to see the changes that were made to it. Now, this does not take up a lot of time, but if it happens often it can add up significantly.

There is a way to have the page automatically refresh when a change is made to the component. This can be accomplished by using the “cq:listeners” node that is the following type: “cq:EditListenersConfig”. This node type is used when you want the page to refresh whenever a certain action is done to the component.

Some of the properties that the node can have are:

  • beforeedit
  • beforecopy
  • afteredit
  • aftermove
  • afterdelete

You can find more properties that the node can have here: cq:listeners

In order to use this node you need to create a “cq:editConfig” node under your component, and then add the “cq:EditListenersConfig” node as a child of the “cq:editConfig” node.

You can find an example here: Refresh Page When Component Is Modified