How to set in xml code cq_dialog a default model value to Touch UI select Model Path ? | Community
Skip to main content
Level 3
May 29, 2023
Solved

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

  • May 29, 2023
  • 1 reply
  • 917 views

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>
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by B_Sravan

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

1 reply

B_Sravan
Community Advisor
Community Advisor
May 29, 2023

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

Level 3
May 29, 2023

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. 
B_Sravan
Community Advisor
B_SravanCommunity AdvisorAccepted solution
Community Advisor
May 29, 2023

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