Expand my Community achievements bar.

SOLVED

Issue in including the component

Avatar

Level 2

Hi All,

I am trying to include the componentB into componentA using the data-sly-resource with below syntax in the parent component (Component A)

<div data-sly-resource="${ 'title' @ resourceType='myproject/component/content/title '}"></div>

When I drag the component A, I am able to open the dialog box of component B and it throws an below error only for the first time when we try to  open the dialog.

Error during include of component '/apps/myproject/components/content/componentB'

Error Message:

org.apache.sling.api.scripting.ScriptEvaluationException:

Processing Info:

I suspect because the node for componentB has not created under jcr:content of page path ,It is created once we open the dialog and add some configuration, Is there any way I can create the node manually for the component B when the parent component A is dragged on the page.

Thanks in advance,

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi All,

Thanks for the response,

The issue is with the child component and able to sort it by modify sightly call in child component

View solution in original post

10 Replies

Avatar

Community Advisor

Hi,

Which version are you using?

I tried in 6.3 I am not getting any error and node is getting created for componentB.

below is my code.

Screen Shot 2018-06-06 at 3.28.31 PM.png

Thanks

Arun



Arun Patidar

Avatar

Level 2

Hi Arun,

I am using the Aem 6.3 with SP2

Is the cmp node is created as soon as I drag the parent component , without opening the dialog of div-check component ??

Avatar

Level 10

Is your Component A a container component like a Responsive Layout container?

Avatar

Community Advisor

Hi Girish,

No, cmp node is getting created after opening dialog but I am not getting any error which you've mentioned.



Arun Patidar

Avatar

Level 2

Hi scott,

It's not a container component.

Avatar

Level 2

Hi Arun,

Is there any way to create the node dynamically when the parent component is dragged.

Avatar

Level 10

Hi,

I am not seeing any error. See the screenshot show.

IncludeComponent1.PNG

IncludeComponent.PNG

Thanks,

Ratna Kumar.

Avatar

Level 10

Hi,

Title node is getting created after when you edit the dialog of the included component. See the image below.IncludeComponent2.PNG

Thanks,

Ratna Kumar.

Avatar

Level 10

I am not a big fan of nesting components - unless the parent is a container - like a Grid layout and the child is a component that is suppose to go within the grid - like a card compoennt. For example - the Grid Parent component:

GRID1.png

The child card components:

Grid2.png

This shows a better practice of parent/child AEM components.

Avatar

Correct answer by
Level 2

Hi All,

Thanks for the response,

The issue is with the child component and able to sort it by modify sightly call in child component