2017-04-26 84 views
0

這是我面臨的問題,我有很簡單的A和B組,使用一個數據狡猾資源嵌套組件刷新編輯後

我可以編輯用於內部成分B 的組件A,但我需要手動刷新頁面或編輯組件B,如果我想查看我應用的更改。

我嘗試添加了CQ:監聽器,但沒有運氣

<cq:listeners 
    jcr:primaryType="cq:EditListenersConfig" 
    afteredit="REFRESH_PAGE" 
/> 

這是我的一個組件.content.xml:

<?xml version="1.0" encoding="UTF-8"?> 
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" 
    jcr:description="component A" 
    jcr:primaryType="cq:Component" 
    jcr:title="Component A" 
    allowedParents="[ */*parsys]" 
    componentGroup="testComponent"/> 

這是我對於B .content.xml成分:

<?xml version="1.0" encoding="UTF-8"?> 
    <jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" 
    xmlns:jcr="http://www.jcp.org/jcr/1.0" 
      jcr:primaryType="cq:Component" 
      jcr:title="Component" 
      componentGroup="testComponent"/> 

這裏是CQ:組分A

的editConfig 0
<?xml version="1.0" encoding="UTF-8"?> 
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" 
    cq:dialogMode="floating" 
    jcr:primaryType="cq:EditConfig"> 
    <cq:listeners 
     jcr:primaryType="cq:EditListenersConfig" 
     afteredit="REFRESH_PAGE"/> 
</jcr:root> 

我正在使用AEM 6.2。

任何人可以幫助這個嗎?

由於

+0

這很奇怪,因爲你的'cq:listeners'似乎沒問題。如果您向我們提供更多信息,它可能會有幫助這兩個組件的'.content.xml'文件的外觀如何?組件'B'具體定義爲一個容器組件?你可以發佈你的整個'cq:editConfig'嗎? – Jens

+0

組件B未被定義爲容器,我該怎麼做?感謝您的回答 – Seb

+0

您必須在組件B中添加'cq:isContainer =「{Boolean} true」'我不知道這是否真的有幫助,但它可能是缺少的東西:) – Jens

回答

0

在CQ:組分A editConfig節點(我理解是該內部部件),你嘗試:

<?xml version="1.0" encoding="UTF-8"?> 
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" 
    jcr:primaryType="cq:EditConfig"> 
    <cq:listeners 
    jcr:primaryType="cq:EditListenersConfig" 
    afteredit="REFRESH_PARENT"/> 
</jcr:root> 

這將迫使母體組分B時刷新編輯組件A.我使用這種方法來定製佈局/網格組件。