How to apply custom sorting to a MultiSelect Lookup in Freedom UI?

Hello Community,

I'm struggling with the MultiSelect Lookup component in Freedom UI. I need to sort the available options in the dropdown by a specific Integer column (NcsOrden) instead of the default Name column.

I've already successfully implemented the Predefined Filter in the viewModelConfigDiff to filter the records, but I can't find a way to change the sort order.

What I've tried so far:

  • crt.LoadDataRequest Handler: Adding a type: "sorting" object to request.parameters. This triggers a TypeError regarding a 'type' property being undefined in the core JS.
  • viewModelConfigDiff: Adding sortingConfig to the attribute. This causes the page to crash with a TypeError in _loadStaticModel.

Has anyone successfully managed to sort a MultiSelect list by a column other than the Primary Display Column? If this is not currently supported via No-Code or standard Handlers, what would be the recommended approach?

Thanks in advance!

 

Julio Falcon

Like 1

Like

3 comments

Hello,
Thank you for pointing this out. As far as I know, there is no explained way to apply custom sorting rules to a multiselect lookup. The dedicated idie have already been registered to our R&D team. As a workaround, you can change the lookup select from dropdown to window, and there configure the needed sorting in the UI. 

+1 for selecting an order

Hello colleagues,

Coming back to close the loop on this one. After going through all the approaches mentioned in this thread, here is what actually worked.

What does NOT work (confirmed):

  • sortingConfig inside viewModelConfigDiff → crashes the page with a TypeError in _loadStaticModel
  • crt.HandleViewModelInitRequest + _List_Sorting → that attribute does not exist for MultiSelect (it works for simple lookups, not here)
  • crt.LoadDataRequest + injecting into request.parameters → not effective for MultiSelect

What WORKS:

Use crt.ChangeViewModelAttributeValueRequest via executeRequest, targeting the _Items_Sorting attribute — note it's _Items_Sorting, not _List_Sorting.

The key: trigger it at the moment the MultiSelect becomes visible, not on page init.

await request.$context.executeRequest({
    type: "crt.ChangeViewModelAttributeValueRequest",
    $context: request.$context,
    attributeName: "MultiSelect_YourAttribute_List_Items_Sorting",
    attributeValue: [
        { columnName: "YourSortColumn", direction: "asc" }
    ]
});

 

Replace MultiSelect_YourAttribute with your MultiSelect attribute name and YourSortColumn with the column to sort by. Tested on Creatio 8.3.x Freedom UI.

Hope this saves someone the time we spent on it.

Regards,
julio

Show all comments