Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

How to set in xml code cq_dialog a default model value to Touch UI select Model Path ?

Avatar

Level 3

NathanVieira_0-1685372429042.png

I want to restrict to author select only the Model that I want, like FAQ Model to this component, how can I do that? 

 

Here belows there's the ModelPath xml code 

<modelPath
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/coral/foundation/form/select"
   emptyText="Select"
   fieldDescription="Content Fragment Model from which to build the list."
   fieldLabel="Model"
   name="./modelPath">
 <datasource
     jcr:primaryType="nt:unstructured"
     sling:resourceType="core/wcm/components/contentfragmentlist/v2/datasource/models"/>
 </modelPath>
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Please overlay the component or have an alternate data-source and perform your logic.

View solution in original post

3 Replies

Avatar

Community Advisor

Hi @NathanVieira ,

set selected (Boolean) to true. In future, to find out such properties, refer the render.jsp of the respective resourceType. In this case, refer this file "/libs/granite/ui/components/coral/foundation/form/select/render.jsp"

In xml, add this value, "selected="{Boolean}true" to the option item that you wanted to be defaulted to. 
Also, you must use override your data-source(option items), as you should not do these changes to the core component.

Thank you,
Sravan

Avatar

Level 3

It's not a custom component but Content Fragment List core component, so the model path return

 

<datasource

 jcr:primaryType="nt:unstructured 
 sling:resourceType="core/wcm/components/contentfragmentlist/v2/datasource/models/"/>
 
I can't use "selected="{Boolean}true" to the option item that I want to be default, cause I don't have that option in code. 

Avatar

Correct answer by
Community Advisor

Please overlay the component or have an alternate data-source and perform your logic.