Possibility to order options in a drop-down menù with Freedom UI
Hi all,
We want, in Freedom UI, to order as per customer need the options in a drop-down menu.
We know that this implementation is possible in Classic UI but we don't know how to address it using Freedom UI.
Can anyone help us in addressing our customer request?
Thank you very much in advance.
Best regards
Stefano
Like
Hello,
Please specify where exactly you need a drop-down menu;
Please provide us with the screenshots of the Classic UI functionality that you want in Freedom UI.
Antonii Viazovskyi,
I believe Stefano is referring to a lookup displayed as a drop down. I would love to know if those can be sorted as well. They're typically sorted in alphabetical order, any of my attempts to change the order in the load request don't work.
Ryan
Antonii Viazovskyi,
Hello Antonii,
I've a lookup with figures 1, 2, 3, ,4, 5, 6, 7, 8, 9, 10... the lookup values are sorted alphabetically so the result is 1, 10, 2, etc..
I can add a leading 0 or change the collate rule for the "Name" field
CREATE COLLATION numeric (provider = icu, locale = 'en-u-kn-true'); ALTER TABLE "UsrPercentDeductible"
ALTER COLUMN "Name" SET DATA TYPE character varying(250) COLLATE "numeric";
Hi All,
As stated by Ryan I'm referring to a lookup dispalyed as a drop down. Is there a way to configure a custom sorting in that situation?
Best Regards
Stefano
STEFANO FERRARI,
Unfortunately, there are no basic system tools to change the alphabetical filtration order. To implement a custom filtration order, additional development will be needed.
You can check the below posts where similar business tasks have been already discussed: https://community.creatio.com/questions/sorting-values-lookup-field-besides-alphabetic-order https://community.creatio.com/questions/sorting-drop-down-lookup https://community.creatio.com/questions/freedom-ui-sorting-lookup https://community.creatio.com/questions/change-order-lookup-values-list
In addition, a task has already been registered in our R&D team to consider and implement such a feature in future releases
Hi guys,
I have decided to take a quick look at this and managed to get it working.
For example, adding this handler on the Accounts_FormPage should filter the "Type" by "Id" descending.
(In the code block change the ">" to ">", can't seem to fix this in the reply editor)
{ request: "crt.HandleViewModelInitRequest", handler: async (request, next) => { let sortingConfigList = await request.$context.Type_List_Sorting; let firstSortingConfig = sortingConfigList[0]; firstSortingConfig.columnName = "Id"; firstSortingConfig.direction = "desc"; //desc or asc return next?.handle(request); } }
So the page context attribute we need to change is attributecode_List_Sorting.
This is a list of "order configurations" (so you can order by multiple columns for example)
So we just need to get the first item in this list and change the columnName from Name to whatever other field we need to order on
And we can optionally change the direction property to "desc" to order descending (it is "asc" by default).
Thanks, I have an additional question. I have more than one lookup to be needed to sort in accounts, use this code, but sort just one. What's wrong?
{ request: "crt.HandleViewModelInitRequest", // 1.- Typo Empresa handler: async (request, next) => { //await next?.handle(request); let sortingConfigList = await request.$context.Type_List_Sorting; let firstSortingConfig = sortingConfigList[0]; firstSortingConfig.columnName = "NdosOrdenarPor"; // Campo nuevo creado en AccountType firstSortingConfig.direction = "asc"; //desc or asc return next?.handle(request); }, // 2.- Nro de Empleados handler: async (request, next) => { //await next?.handle(request); let sortingConfigList = await request.$context.EmployeesNumber_List_Sorting; let firstSortingConfig = sortingConfigList[0]; firstSortingConfig.columnName = "Position"; firstSortingConfig.direction = "asc"; //desc or asc return next?.handle(request); }, // 3.- Annual revenue/Facturacion anual handler: async (request, next) => { //await next?.handle(request); let sortingConfigList = await request.$context.AnnualRevenue_List_Sorting; let firstSortingConfig = sortingConfigList[0]; firstSortingConfig.columnName = "FromBaseCurrency"; firstSortingConfig.direction = "asc"; //desc or asc return next?.handle(request); //next?.handle(request); } }
Julio Falcon (Cibernética),
You will need to combine these into one "handler"
{ request: "crt.HandleViewModelInitRequest", handler: async (request, next) => { // 1.- Typo Empresa let sortingConfigListType = await request.$context.Type_List_Sorting; let firstSortingConfigType = sortingConfigListType[0]; firstSortingConfigType.columnName = "NdosOrdenarPor"; // Campo nuevo creado en AccountType firstSortingConfigType.direction = "asc"; //desc or asc // 2.- Nro de Empleados let sortingConfigListEmployeesNumber = await request.$context.EmployeesNumber_List_Sorting; let firstSortingConfigEmployeesNumber = sortingConfigListEmployeesNumber[0]; firstSortingConfigEmployeesNumber.columnName = "Position"; firstSortingConfigEmployeesNumber.direction = "asc"; //desc or asc // 3.- Annual revenue/Facturacion anual let sortingConfigListAnnualRevenue = await request.$context.AnnualRevenue_List_Sorting; let firstSortingConfigAnnualRevenue = sortingConfigListAnnualRevenue[0]; firstSortingConfigAnnualRevenue.columnName = "FromBaseCurrency"; firstSortingConfigAnnualRevenue.direction = "asc"; //desc or asc return next?.handle(request); }, }