Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Dialogs with Multifield in SPA Editor - Angular

Avatar

Avatar
Validate 1
Level 1
claudiab1560191
Level 1

Likes

2 likes

Total Posts

7 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Give Back
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 1
claudiab1560191
Level 1

Likes

2 likes

Total Posts

7 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Give Back
Boost 1
Applaud 5
View profile
claudiab1560191
Level 1

05-03-2020

I'm on 6.5.2 - Using the SPA Editor for Angular.  Coral 3 for authoring dialog.

 

I created create a simple Angular component and mapped it an AEM Component.  My AEM Component has an authoring dialog that has two multifields:

1) Multifield One : (Partial Snippet of Dialog)

 

 

 

 

<link sling:resourceType="granite/ui/components/coral/foundation/form/multifield" fieldDescription="Click '+' to add a new link" fieldLabel="Links" jcr:primaryType="nt:unstructured" composite="{Boolean}true">
<field sling:resourceType="granite/ui/components/coral/foundation/container" jcr:primaryType="nt:unstructured" name="./links">
<items jcr:primaryType="nt:unstructured">
<linkText jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/textfield" fieldLabel="CTA Text" required="true" name="./linkText" />
<linkPath jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/pathbrowser" fieldLabel="CTA Link Path" required="true" name="./linkPath" />
<linkTarget jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/select" fieldLabel="CTA Link Target" name="./linkTarget">
<items jcr:primaryType="nt:unstructured">
<same jcr:primaryType="nt:unstructured" text="Same window" value="" />
<new jcr:primaryType="nt:unstructured" text="New window" value="_blank" />
</items>
</linkTarget>
</items>
</field>
</link>

 

 

 

 

2) Simplified Multifield

 

 

 

 

<headlines jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/multifield" fieldDescription="Click 'Add field' to add new content dropdown." fieldLabel="Headlines">
            <field jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/textfield" required="true" name="./headlines" />
</headlines>

 

 

 

 

In the SPA editor, I can update the authoring dialog fields for both multifields and can see the changes reflected in the JCR through CRX. What I do not see is updates to  Multifield One in the model.json. But I can see updates to Simplified Multifield updating in the model.json.

 

I'm curious... Why do complex multifields get ignored by the Model.json (provided by JS SDK)? 

Providing sample files:  Sample Component Files 

1. en.model.json - Highlighted section with missing child nodes

2. zip file with content and dialog

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 5
Level 2
ahmedmusallam
Level 2

Likes

7 likes

Total Posts

11 posts

Correct Reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Boost 5
Level 2
ahmedmusallam
Level 2

Likes

7 likes

Total Posts

11 posts

Correct Reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 1
View profile
ahmedmusallam
Level 2

09-03-2020

I had assumed that you have an exporter associated with your resource type, but it seems you do not, and that is the issue.

To understand this better, please refer to: https://docs.adobe.com/content/help/en/experience-manager-learn/foundation/development/understand-sl...

and
https://sling.apache.org/documentation/bundles/models.html#exporter-framework-since-1-3-0-


This is also an excellent resource on how to build exporters with examples:

https://docs.adobe.com/content/help/en/experience-manager-learn/foundation/development/develop-sling...



It seems that, by default, direct properties on the resource are exported, which is why you see other components working just fine. But for a composite multifield, the data is saved as child node, and the default exporter does not handle that. I assume because it assumes it's an irrelevant node.

basically, you do need to implement a sling model for your component, and add exporter annotations. Then grab the child nodes (saved by multifield) and export them.

Here is a, somewhat, related implementation:
https://github.com/adobe/aem-core-wcm-components/blob/c69fdc63fc0f2fb122d65eb4091d9bef872e09fb/bundl...

This returns a collection of "ListItem" (the real impl is "PageListItemImpl.java")

Hope this helps! Give it a shot, and post the Model you used here if you run into any issues.

Answers (2)

Answers (2)

Avatar

Avatar
Validate 1
MVP
Nikhil-Kumar
MVP

Likes

240 likes

Total Posts

253 posts

Correct Reply

38 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile

Avatar
Validate 1
MVP
Nikhil-Kumar
MVP

Likes

240 likes

Total Posts

253 posts

Correct Reply

38 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile
Nikhil-Kumar
MVP

25-08-2020

@claudiab1560191 

Multifield data won't be available in JSON exported by default.

You need to create a separate class for the fields which are there in multifield,
Inject the resource of the multifield in the main model class and adapt the multifiled java class in the main model class.


Thanks,
Nikhil

Avatar

Avatar
Boost 5
Level 2
ahmedmusallam
Level 2

Likes

7 likes

Total Posts

11 posts

Correct Reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Boost 5
Level 2
ahmedmusallam
Level 2

Likes

7 likes

Total Posts

11 posts

Correct Reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 1
View profile
ahmedmusallam
Level 2

06-03-2020

I'm not sure this is actually related to the SPA editor, it could be a number of things.

To make this easier for us to debug and help. could you create a simple empty component, maybe in we-retail project, with a sample dialog that does not provide you the desired model.json output, then package that component?

We can then install that sample component and play with it locally to determine the issue you are seeing.

Thanks!