Render dropdown option based on condition | Community
Skip to main content
Level 6
February 22, 2022
Solved

Render dropdown option based on condition

  • February 22, 2022
  • 1 reply
  • 867 views

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 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
February 22, 2022