I have list of drop downs this list contain some of users i want if a user is selected in first row so i can remove it or disable it in the following rows how can i do in outsystems?
hi @Mohab Esam , hope you're doing well.You can use a local variable to manage the selected users, and filter dropdown options dynamically.
Hi @Mohab Esam,
Set the "disabled" attribute: For each option you want to disable, set the disabled attribute to true using setAttribute("disabled", "true")
I found a solution using JavaScript as done in one of the Forge components:
"EnableDisableDropdownOption_gradout"
For each option to be disabled it set:
ddrId[i].setAttribute("disabled", "true");
ddrId[i].setAttribute("style", "color:"+$parameters.fontcolor+";background-color:"+$parameters.backgroundcolor+";");
Hope it helps.
Thank you
You can dynamically filter the options shown in each dropdown based on the selections made in other rows.To do this, keep a list of all users selected across the rows.Then, for each dropdown, exclude users who have already been chosen in other rows.
Thanks.
Hi @Mohab Esam ,You will find working examples below: one demonstrates how to hide the selected element from the second dropdown, and the other shows how to disable it.Kindly review the attached OML file , and let me know if you need any further updates Have a great day !
Working Example Link
this solution worked with me for only two dropdowns but i have list of dropdowns so how can i handle this @Iheb Maatali Riahi
Hi @Mohab Esam , I made some updates to match your needs. Please check the link for a working example that shows hiding or disabling items inside the dropdown list (DDL).I tried to make it as dynamic as possible — just don't forget to add the specific class " disabled-select" to any new dropdown list you add .Working Example Link
=> classe Added "disabled-select"Also, I will attach the OML.I hope this helps , have a great day !
Hallo @Mohab Esam ,
Add the onClick Event: You'll need to handle the click event for the items, check whether the item is active, and prevent the selection if it's not.
Prevent Select on Inactive Item: If the item is inactive, clear the selection and return to the default empty select state.
Conditional CSS Styling: Apply styles dynamically based on whether the item is active or not.
https://personal-oqbcw6a2.outsystemscloud.com/disablesomeitemsindropdown/Screen1?_ts=638817062805772043
Hi,
I have created a sample .oml when a user select an option in the first dropdown and that selected user will no longer appear in the second dropdown. Hope it helps.
Thanks,
Sriyamini.J
Hi @Mohab Esam, I highly recommend checking out this article OutSystems Reactive— Mutually exclusive Dropdowns by @Dorine Boudry, it offers a really interesting approach.
Also @Dorine Boudry, it would be great if you could add this article to your profile to make it easier to find.
ThanksGitansh Anand
@Gitansh Anand ,
agreed, I have been on a bit of a break from OutSystems lately, I'm behind on some of the admin work.
Dorine
Hi @Mohab Esam ,
Maintain Selected Users List: Create a local variable of type List (e.g., SelectedUserIds : List of Identifier) to keep track of the user IDs already selected in the rows.
Update on Change: On the OnChange event of each dropdown, update the SelectedUserIds list to include the selected user ID (and remove any previously selected ID if changed).
Filter Dropdown Options per Row:When binding the dropdown source (e.g., Users), apply a filter using a local function or expression: ListFilter(Users, not SelectedUserIds.Contains(User.Id) or User.Id = CurrentRow.UserId)This ensures the current row still shows its selected value even if it’s in the SelectedUserIds
Alternative (Disabling Instead of Removing):If you prefer to disable used users instead of hiding them, use IsSelected = SelectedUserIds.Contains(User.Id) in the dropdown and disable the option via conditional formatting (requires a custom widget or JavaScript if needed).
Hope this works.
Senthil