Expand my Community achievements bar.

SOLVED

Render dropdown option based on condition

Avatar

Level 4

Hello All - Could someone clarify the below?

Question 1:

There is a dropdown in a dialog with some options as dropdown values. I wanted to display the "Option C" only for the selected user group or admin user.
is there any way to accomplish without using any datasource.
<items jcr:primaryType="nt:unstructured">
<options
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/select"
emptyText="Select Option"
fieldLabel="Option Selection"
multiple="{Boolean}false"
name="./selectedoption"
required="{Boolean}true">
<items jcr:primaryType="nt:unstructured">
<optiona
jcr:primaryType="nt:unstructured"
text="Option A"
value="optiona"/>
<optionb
jcr:primaryType="nt:unstructured"
text="Option B"
value="optionb"/>

<!- Need to display only for specific group/user -->
<optionc
jcr:primaryType="nt:unstructured"
text="Option C"
value="optionc"/>
</items>
</options>
</items>

=================================================
Question 2: In the below dailog's rendercondition, how to check the expression based on user group or user type?
<options
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/select"
fieldLabel=""
name="./selectedoption">
<items jcr:primaryType="nt:unstructured">
<optiona
jcr:primaryType="nt:unstructured"
text="Option A"
value="optiona"/>
<optionb
jcr:primaryType="nt:unstructured"
text="Option B"
value="optionb"/>
</items>
<granite:rendercondition
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/renderconditions/simple"
expression="${}"/>
</options>

 

@arunpatidar 

 

@VeenaVikraman 

@Theo_Pendle 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
1 Reply

Avatar

Correct answer by
Community Advisor