Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Author Dialog Multi Select Render Auto Sorting

Avatar

Community Advisor

Hello members,
I have a multi-select field. I select multiple values from the select box.

After submitting the dialog, values are saved according to my selected order.
The problem is when I reopen the dialog, it sort alphabetically. How do I prevent this?

 

Sady_Rifat_0-1728050810798.png

 

This is my sample code,

<buttonIcon
        jcr:primaryType="nt:unstructured"
        sling:resourceType="granite/ui/components/coral/foundation/form/select"
        multiple="true"
        fieldLabel="Button Icon"
        name="./buttonIcon">
    <items jcr:primaryType="nt:unstructured">
        <arrow
                jcr:primaryType="nt:unstructured"
                text="Arrow"
                value="arrow"/>
        <email
                jcr:primaryType="nt:unstructured"
                text="Email"
                value="email"/>
        <next
                jcr:primaryType="nt:unstructured"
                text="Next"
                value="next"/>
        <check
                jcr:primaryType="nt:unstructured"
                text="Check"
                value="check"/>
    </items>
</buttonIcon>

 

1 Reply

Avatar

Community Advisor

Hi,

 

From what I can see in the AEM Granite Select implementation, the options are already sorted in the backend, rather than when the HTML is being built (see line 276 of /libs/granite/ui/components/coral/foundation/form/select/render.jsp). Therefore, an overlay won’t work in this case. Your best option would be to tweak this using JavaScript.

 

Hope this helps.



Esteban Bustamante