Disable some values in a combo box

Disable some values in a combo box

  

hi

I have a data source that returns order periods. in the record list that I use as a data source for the combo box, I have a boolean field that tells if the period is enabled for ordering. I want to represent the boolean value in a combo box, as enabled or disabled items:

the values in the combo box, that have a value FALSE must be disabled in the combo box, just as the value 2017-03:

I know that this can be achieved by adding 'disabled' in the HTML. 


What I do not know is how I can manipulate the outsystems combo box, to achieve this behaviour.

Anyone knows how this can be achieved? is this possible?

Unfortunately this is not possible, as far as I know.

That's not possible with Outsystems default combo box. The several drop down or combo box on forge but none of them seem to have that feature.

You have two options, develop a new combo box component with that feature or remove the disabled items from drop down.

Well, you could try to muck around with injecting HTML or the like, but I'd advise against it. Just drop that use-case :).

thanks for the replies. I'll try another approach

Nelson Inácio wrote:


You have two options, develop a new combo box component with that feature or remove the disabled items from drop down.

How would one remove items from the drop down?


PJ M wrote:

Nelson Inácio wrote:


You have two options, develop a new combo box component with that feature or remove the disabled items from drop down.

How would one remove items from the drop down?


You can build the custom list on the preparation, or when the value you're checking changes

 1. Set a screen local variable of type List of RecordYouWantOnTheDropdown

 2. Set the Dropdown's Source Record List to the previously created variable

 3. On the preparation (for example) ForEach -> List you want to filter, check the condition(s). If the element meets the condition, append the element to the previously created list.

4. You're done!


Hope this helps!


  -CLSJ

I figured it out after I asked the question! :)

That's pretty much how I just did it it. In this case, I built the list from an aggregate with a filter that accepted values from other form fields and then did an Ajax refresh of the drop down with it filtered behind the scenes.

I'm still learning OutSystems, but I'm getting there. 

Hi,

u can use ListRemove for particular item remove in the list.



-Vijay M-

Vijay,

Though that is true, if you're first building the list yourself, it's better to not include the items in the first place! Also, PJ's question was already answered, so please check the topic before you answer!

@PJ: the original topic was already over a year old, it's better to not "necro" old topics, and instead create a new one (especially since in this case your question didn't really have to do with the original!).

Kilian Hekhuis wrote:

Vijay,

Though that is true, if you're first building the list yourself, it's better to not include the items in the first place! Also, PJ's question was already answered, so please check the topic before you answer!

@PJ: the original topic was already over a year old, it's better to not "necro" old topics, and instead create a new one (especially since in this case your question didn't really have to do with the original!).


Sure.

Rogier Mastenbroek wrote:

hi

I have a data source that returns order periods. in the record list that I use as a data source for the combo box, I have a boolean field that tells if the period is enabled for ordering. I want to represent the boolean value in a combo box, as enabled or disabled items:

the values in the combo box, that have a value FALSE must be disabled in the combo box, just as the value 2017-03:

I know that this can be achieved by adding 'disabled' in the HTML. 


What I do not know is how I can manipulate the outsystems combo box, to achieve this behaviour.

Anyone knows how this can be achieved? is this possible?


Hi Rogier Mastenbroek,

I had similar kind of functionality in my web application. im passing the list in the form of text separated by ','

I have achieved this using jquery and also created a sample app for the understanding. 

check out at the below url may help you out.

https://kiritkumar.outsystemscloud.com/ComboBox/Home.aspx

Thanks

Kirit