Introducing a sly logic as a parent sly will harm existing data in AEM ?

Avatar

Avatar

JakeCham

Avatar

JakeCham

JakeCham

21-01-2021

<sly data-sly-test="logic"> //Newly added logic

    <sly data-sly-test="logic"> //existing logc

    </sly>

</sly>

Here I have wrapped the existing logic by a new logic and all of my existing content related to that inside sly logic got lost.

Any inputs highly appreciate.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

3.1K

Likes

1.2K

Correct Reply

883

Avatar

Arun_Patidar

MVP

Total Posts

3.1K

Likes

1.2K

Correct Reply

883
Arun_Patidar
MVP

21-01-2021

If your first condition is rely on some new properties then yes the condition will always be a false and you will not see any content. If this is a case then add complex condition 
e.g. <sly data-sly-test="{properties.newProp && logic}">

Answers (4)

Answers (4)

Avatar

Avatar

kiranparab

Avatar

kiranparab

kiranparab

21-01-2021

Hi,

 

Case A -

Looks like new logic " data-sly-test='logic' " returning false which don't allow to execute the inner portion

Case B -

If you have 2 different test conditions then define with variables like data-sly-test.new="logic" and data-sly-test.old="logic"

 

Thanks,

Kiran Parab

Avatar

Avatar

BrianKasingli

MVP

Avatar

BrianKasingli

MVP

BrianKasingli
MVP

21-01-2021

Try to add variables to your sightly elements.

 

<sly data-sly-test.modelA="com.mysite.core.slingmodels.button"> //Newly added logic

    <sly data-sly-test.modelB="com.mysite.core.slingmodels.buttonflat"> //existing logc

    </sly>

</sly>

 

Avatar

Avatar

Suraj_Kamdi

MVP

Avatar

Suraj_Kamdi

MVP

Suraj_Kamdi
MVP

21-01-2021

@JakeCham Please provide some sample code snippet just to know what you are actually doing?

Avatar

Avatar

Anudeep_Garnepudi

MVP

Avatar

Anudeep_Garnepudi

MVP

Anudeep_Garnepudi
MVP

21-01-2021

@JakeCham 

I don't think you need inner test condition because you are already checking on top. Try removing the inner/old/existing test condition.

Hope that works.

-AG