51
Views
8
Comments
Solved
Dropdown Search
Question

Hi everyone 

I want to disable a option in Dropdown Search.

I have read Virtual Select but I don't know how to use it.

So please give  me somw way to di this.

Thanks !!

Solution

Hi Cao,

To address your requirement, you will need to use the setDisabledOptions() method. Please follow the implementation steps outlined below: 

Implementation Steps:

  • Define the DropdownSearch Initialized event handler.
  • Within the Initialized event handler screen action flow
    • Filter/Prepare the disabled options.
    • Using JSONSerialize node - serialize the disabled options.
  • Pass the serialized string value to the JS node to set the DropdonwSearch widget disabled options using the setDisabledOptions() method .
  • In the JS node call the setDisabledOptions() method and provide the input disabled options value.
  • Makes sure to parse the input parameter string value using the JSON.parse() method.

JS Snippet:

OutSystems.OSUI.Patterns.DropdownAPI.GetDropdownById($parameters.DropdownSearchId).virtualselectConfigs.setDisabledOptions(JSON.parse($parameters.DisabledOptions));

Demo link: DropdownSearchOptionDisableTask

Document Link: virtual-select | setdisabledoptions

Refer to the attached oml. I hope this helps you!


Kind regards,

Benjith Sam

NeoLab_DropdownSearchOptionDisableTask.oml

Thanks for you solution!

But I am using OutsystemsUI version 2.12.0 so when run in brower it throw exception that setDisabledOptions can't read.

Do you have any solution for this case

Hi Cao,

Sorry for my late response. You'll need to make a minor adjustment (as highlighted below) to adapt the provided solution to function with OS UI version 2.12.0.

Add an underscore ('_') as a prefix to virtualselectConfigs.

JS Snippet: 

OutSystems.OSUI.Patterns.DropdownAPI.GetDropdownById($parameters.DropdownSearchId)._virtualselectConfigs.setDisabledOptions(JSON.parse($parameters.DisabledOptionValues));

Note: Ensure that you provide the setDisabledOptions method with an array containing the disabled dropdownSearch option values.

I hope this helps you!


Kind regards,

Benjith Sam

Hi Cao,

I hope you're doing well. 

If I understood your question you want to disable an option in the list that populates the Dropdown Search, right?

If yes, in the OnAfterFetch action of the Data Fetch that populates your Dropdown Search:

  1. Copy the list to a Local list, using the system action ListAppendAll
  2. Use the system action ListIndexOf to apply the condition and know the exact position of the record that you want to remove
  3. Use the system action ListRemove to remove the record from the list that you don't want to display in the Dropdown Search

Let me know if this solves your issue.

Cheers,

FC


Hi Fábio Miguel Ferreira Coelho

I want show it in the list but can click and select this option


Champion

Hi Cao,

Do you want the option in the list but will be not possible to select?

Regards, Paulo Torres

Hi Paulo Torres 

Yes that is what i want to do 

Solution

Hi Cao,

To address your requirement, you will need to use the setDisabledOptions() method. Please follow the implementation steps outlined below: 

Implementation Steps:

  • Define the DropdownSearch Initialized event handler.
  • Within the Initialized event handler screen action flow
    • Filter/Prepare the disabled options.
    • Using JSONSerialize node - serialize the disabled options.
  • Pass the serialized string value to the JS node to set the DropdonwSearch widget disabled options using the setDisabledOptions() method .
  • In the JS node call the setDisabledOptions() method and provide the input disabled options value.
  • Makes sure to parse the input parameter string value using the JSON.parse() method.

JS Snippet:

OutSystems.OSUI.Patterns.DropdownAPI.GetDropdownById($parameters.DropdownSearchId).virtualselectConfigs.setDisabledOptions(JSON.parse($parameters.DisabledOptions));

Demo link: DropdownSearchOptionDisableTask

Document Link: virtual-select | setdisabledoptions

Refer to the attached oml. I hope this helps you!


Kind regards,

Benjith Sam

NeoLab_DropdownSearchOptionDisableTask.oml

Thanks for you solution!

But I am using OutsystemsUI version 2.12.0 so when run in brower it throw exception that setDisabledOptions can't read.

Do you have any solution for this case

Hi Cao,

Sorry for my late response. You'll need to make a minor adjustment (as highlighted below) to adapt the provided solution to function with OS UI version 2.12.0.

Add an underscore ('_') as a prefix to virtualselectConfigs.

JS Snippet: 

OutSystems.OSUI.Patterns.DropdownAPI.GetDropdownById($parameters.DropdownSearchId)._virtualselectConfigs.setDisabledOptions(JSON.parse($parameters.DisabledOptionValues));

Note: Ensure that you provide the setDisabledOptions method with an array containing the disabled dropdownSearch option values.

I hope this helps you!


Kind regards,

Benjith Sam

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.