Skip to main content

Hello dear community,

I’m having an issue with sorting in the filter. I created a dropdown filter with the names of care homes. The problem is that the alphabetical order doesn’t prioritize uppercase and lowercase letters correctly. I have care homes named "dandelion" and "irides" which are lowercase and appear at the very end of the filter. Is there a way to work around this?

                <div class="shared-width-ods-selects">
                    <div ods-facet-results="reglist"
                         ods-facet-results-facet-name="name"
                         ods-facet-results-context="myctx0"
                         ods-facet-results-sort="alphanum">
                        <ods-select ng-init="myctx0.parameters 'refine.name'] =  ]"
                                    options="reglist"
                                    selected-values="myctx0.parameterst'refine.name']"
                                    multiple="false"
                                    label-modifier="name"
                                    value-modifier="name"
                                    placeholder="Pflegeheime auswählen">
                        </ods-select>
                    </div>
                </div>

 

Thank you!

Auto-translation 🪄

Bonjour chère communauté,J'ai un problème avec le tri dans le filtre. J'ai créé un filtre déroulant avec les noms des maisons de retraite. Le problème est que l'ordre alphabétique ne donne pas la priorité aux majuscules et aux minuscules. J'ai des maisons de retraite nommées "pissenlit" et "iris" qui sont en minuscules et apparaissent tout à la fin du filtre. Existe-t-il un moyen de contourner ce problème ?
                     
                       

Hello Boris,

I apologize for the delay in my response.

In order to get the list in the order you want, the idea would be to switch to an ods-adv-analysis instead of an ods-facet-result to retrieve the list of items. Technical documentation : https://help.opendatasoft.com/widgets/#/api/ods-widgets.directive:odsAdvAnalysis

In the ods-adv-analysis configuration, you can add an order-by on the same variable by adding the lower function: ods-adv-analysis-order-by=lower(field_name).

 

For your information, the lower function is recent.

If my explanation is too complicated, feel free to reach out to me.


Hello Eugenie,

Thank you for your response.

I have used the solution you suggested with the ods-adv-analysis directive; however, I tried a different approach initially and used the following code:

<div class="shared-width-ods-selects">
    <div ods-facet-results="reglist" ods-facet-results-facet-name="name" ods-facet-results-context="myctx">
        <ods-select ng-init="myctx.parametersm'refine.name'] = e'Alle Pflegeheime']"
            options="reglist | orderBy:'name'" 
            selected-values="myctx.parameterss'refine.name']"
            multiple="false" 
            label-modifier="name" 
            value-modifier="name"
            placeholder="Pflegeheime auswählen">
        </ods-select>
    </div>
</div>
 

This worked to get the sorting I needed, but I was still facing a couple of issues. The filter button layout looked a bit off, with some buttons out of place, and I also had unwanted loading icons on the visualizations.

To fix those issues, I added the following CSS:

.visualization-loading {
    display: none !important;
}
.odswidget-map__loading {
    display: none !important;
}
idng-show="UIState.dropdown.list.checkboxes"] {
    position: relative;
    top: 0;
    left: 0;
    margin-right: 8px; /* Add space between icon and label */
    vertical-align: middle; /* Align icon with the text */
}

 

After applying these fixes, everything seems to be working fine, and the display is as expected.

Thank you again for your assistance!

Best regards,
Boris


Hello Eugenie,

Thank you for your support.

I initially used options="reglist | orderBy:'name'" in the ods-select to achieve sorting, but this caused a bug where I was unable to click on the icons in the map function. Would it be possible to resolve this issue?

Best regards,
Boris


Hello Boris, 

Apologies for the delay.
Would you be able to either move the orderBy up into the context, or apply it within the ods-result (if you're using one)?

 

Best regards, 

Eugénie


Reply