Expand my Community achievements bar.

Can we use datasource and manual options together in select coral component?

Avatar

Level 4

I'm using AEM 6.5.8
and what I want is to do something like below

<select
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/select"
fieldLabel="select"
name="./select">
<items jcr:primaryType="nt:unstructured">
<option1
jcr:primaryType="nt:unstructured"
selected="{Boolean}true"
text="option1"
value="option1"/>
<option2
jcr:primaryType="nt:unstructured"
text="option2"
value="option2"/>
</items>
<datasource
jcr:primaryType="nt:unstructured"
sling:resourceType="/test/run/url"/>
</link>
2 Replies

Avatar

Level 2

You can achieve the above by adding the two options as default in your datasource. This will ensure your datasource always return two results. I do not think adding a datasource and options work simultaneously. 

Avatar

Level 4

Can you please provide me a sample code of datasource in select as I'm unable to find something on the net.