34
Views
3
Comments
Solved by AI
How to disable elements in DropDownSearch?
Question
Application Type
Reactive

I have DropdownSearch for selecting one element. I need to implement functionality where some elements are disabled and shown as selected, but user cannot unselect it. Is it possible to do it?

2023-12-26 10-35-28
OutSystems Neo
Staff
Solution by AI
In OutSystems, there's no built-in functionality to disable items or make them unselectable in a DropdownSearch widget.

However, you could work around this by customizing the logic in your screen's preparation or inside the action associated with the DropdownSearch's OnChange.

Here's an approach you can consider:

1. You can highlight the selected items in the DropdownSearch using CSS. You can either add a CSS class directly or use an expression to add it dynamically based on some condition.

2. The unselecting part is a bit tricky since DropdownSearch's main purpose is to select and unselect. However, you can get creative by maintaining a record of items that once selected shouldn't be unselected.

3. Create a local variable to store the previous value.

4. Inside the OnChange event for DropdownSearch widget, add your logic to reject the change if the new value is deemed to be an unselectable item.

Please be aware that this solution might not have the exact behavior you wish for. There is no perfect way to do this, but hopefully, these suggestions would be helpful for your situation.
2023-03-24 11-55-45
Pawan Purohit
2023-12-26 10-35-28
OutSystems Neo
Staff
Solution by AI
In OutSystems, there's no built-in functionality to disable items or make them unselectable in a DropdownSearch widget.

However, you could work around this by customizing the logic in your screen's preparation or inside the action associated with the DropdownSearch's OnChange.

Here's an approach you can consider:

1. You can highlight the selected items in the DropdownSearch using CSS. You can either add a CSS class directly or use an expression to add it dynamically based on some condition.

2. The unselecting part is a bit tricky since DropdownSearch's main purpose is to select and unselect. However, you can get creative by maintaining a record of items that once selected shouldn't be unselected.

3. Create a local variable to store the previous value.

4. Inside the OnChange event for DropdownSearch widget, add your logic to reject the change if the new value is deemed to be an unselectable item.

Please be aware that this solution might not have the exact behavior you wish for. There is no perfect way to do this, but hopefully, these suggestions would be helpful for your situation.
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.