Hi,
I am working on a dropdown in Content Fragment Editor to select Elements. Dropdown is coming using /libs/granite/ui/components/coral/foundation/form/select component which is again pointing to a datasource to populate dropdown options.
Dropdown Path- /libs/dam/cfm/admin/content/fragment-editor/jcr:content/content/items/bar/primary/fragmentElements
Select component- /libs/granite/ui/components/coral/foundation/form/select
Datasource path- /libs/dam/cfm/admin/components/datasources/elements/elements.jsp
By default it shows the main element from the dropdown as selected. However I want to select my 2nd element from dropdown on Editor first time load.
Is there way using which I can make this element as selected by default in datasource? PFB screenshots.
Solved! Go to Solution.
Views
Replies
Total Likes
Please refer to the below link
Select — Granite UI 1.0 documentation
selectedboolean
true
to pre-select this option, false
otherwise.
Example:
+ myselect - sling:resourceType = "granite/ui/components/foundation/form/select" - emptyText = "Select" - name = "myselect" + items + option1 - text = "op1" + option2 - text = "op2"
Views
Replies
Total Likes
Please refer to the below link
Select — Granite UI 1.0 documentation
selectedboolean
true
to pre-select this option, false
otherwise.
Example:
+ myselect - sling:resourceType = "granite/ui/components/foundation/form/select" - emptyText = "Select" - name = "myselect" + items + option1 - text = "op1" + option2 - text = "op2"
Views
Replies
Total Likes
Hi Hemant,
I have already gone through the link. That property (selected=true) I can add in a static dropdown option items. Not sure how to add it a dynamic dropdown using datasource.
Can you help me on that?
Thanks!!
Views
Replies
Total Likes
See this article that show use of this use case:
You are correct - the property mentioned in the correct response is to hard coded values - child nodes of the select node.
WHen using DataSource - it almost appears as a First In First Out collection. That is, the first value added to the DataSource appears at the top of the list. There does not appear to be a way to set a default in the dropdown when using DataSource.
Views
Replies
Total Likes
Views
Likes
Replies