May 13, 2020
Estimated Post Reading Time ~

Image not visible on Dialog reopen in AEM

In this post, I am going to sort out a very interesting problem which is occurred when we use the image component as a tab in our custom component.
Most of the time when we want to add an image tab into our component then we use these properties

path – /libs/foundation/components/page/tab_image.infinity.json
xtype – cqinclude

Using this property we are able to add a new tab that provides you a drag & drop or upload an image functionality in your component. Some developers use another approach to add an image tab in our component using xtype smatimage.
Both of these approaches work fine for us but sometimes we face an issue with these component dialogs.

Problem Statement
when we drop an image on this image tab & click on the ok button, we are able to see this image as our component desired functionality, till now everything is working fine. Now when we reopen the dialog & open the image tab, the image will not be displayed. i.e. when we reopen the component dialog image tab it’s not displayed here.

How to resolve this issue –
1). Check sling:resourceSuperType property on your component, it must be present.
2). sling:resourceSuperType property value must be foundation/components/page.
3). Open your component’s .content.xml file and check <jcr:root> tag, here xmlns:sling must be present, for example in my case it is –

<?xml version=”1.0″ encoding=”UTF-8″?>
<jcr:root
xmlns:sling=”http://sling.apache.org/jcr/sling/1.0″
xmlns:cq=”http://www.day.com/jcr/cq/1.0″
xmlns:jcr=”http://www.jcp.org/jcr/1.0″
jcr:description=”Jcr Description.”
jcr:primaryType=”cq:Component”
jcr:title=”Test Component”
sling:resourceSuperType=”foundation/components/page”
allowedParents=”[*/parsys]”
componentGroup=”Test”
/>


The above schema works fine as both of this property is there. After defining these two highlighted properties, test your component & I am damn sure, your component will start functioning properly.


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.