items and sub nodes are getting reset in Multifield coral UI3 AEM 6.5.

Avatar

Avatar

sreenathg397727

Avatar

sreenathg397727

sreenathg397727

22-07-2020

we have used  sling:resourceType="granite/ui/components/foundation/form/multifield" in aem 6.4. Nodes are created like below and its working fine. we used podComponent inside podsContainer component dialog.

podsContainer

             |

            pods

                 |

                 0

                  |

                 assetPod

 

but when we chaged sling:resourceType="granite/ui/components/coral/foundation/form/multifield" in aem 6.5. Nodes needs to be created in below format. but data is resetting for every dialog submission.

podsContainer

             |

            pods

                 |

                items0

                  |

                 assetPod (not creating)

 

 

 

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

ChitraMadan

MVP

Avatar

ChitraMadan

MVP

ChitraMadan
MVP

23-07-2020

Hi @sreenathg397727 ,

 

Please go through below example. It works perfectly with item nodes created in the new structure.

 

_________Dialog______________

<infoItems
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
composite="{Boolean}true"
fieldLabel="Items">
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container"
name="./infoItems">
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<iconUrl
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/pathfield"
fieldLabel="Icon"
name="./iconUrl"
rootPath="/content/dam/"/>
<infoText
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textarea"
fieldLabel="Info Text"
name="./infoText"/>
</items>
</column>
</items>
</field>
</infoItems>
 
________Sling Model_______
@Getter
@Model(adaptables = Resource.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
public class InfoItems {

@Inject
private Resource infoItems;
}
________HTL_________
<sly data-sly-use.model="co.sampleapp.InfoItems">
<ul data-sly-list.infoItem="${model.infoItems.listChildren}">
<li><b>Icon: ${infoItem.iconUrl} Text:</b> ${infoItem.infoText}</li>
</ul>
</sly>

Answers (2)

Answers (2)

Avatar

Avatar

Veena_Vikram

MVP

Avatar

Veena_Vikram

MVP

Veena_Vikram
MVP

23-07-2020

@sreenathg397727 Have you customized the multifield rendering in 6.4 ? The behavior you see in 6.5 is the OOTB rendering behavior. For every item , it will create a node starting items0,items1,... and when each individual field values will go us property in the items node. I would recommend to modify your existing code to match this behavior as this might cause issues for future upgrades. Try to keep customization as less as possible . 

 

Thanks

Veena

Avatar

Avatar

vanegi

Employee

Avatar

vanegi

Employee

vanegi
Employee

23-07-2020