Hello Forum, I have an issue in Moving items between Two multi select dropdown b

Hello Forum, I have an issue in Moving items between Two multi select dropdown boxes.

1. Data getting populated from DB
2. Upon "Selecting single List Item" the selected item should move to the adjacent multi select drop down
3. Upon Clicking "Add All" all the item should move to the adjacent dropdown box.
4. Same for Vice Versa on Remove function is the requirement.

Attached the code. Pls advise if am missing something.

Thanks,
Deepan

Multiselect.txt

OriginalPostID-146624

OriginalPostID-146624

  Discussion posts and replies are publicly visible

Parents
  • I have gone through your code and I would like to put forward a simple approach in the form of a pseudocode and if you implement these steps, the underlying complexity in the code comes down and will be much easier to debug, maintain and in-fact the issue will be resolved:

    - Maintain a master copy of the data present in local!availableCountries, say local!availableCountries_master. Please don't make any modifications in this variable as this will be solely used as reference for addition and removals in the Available and Global Countries data.
              local!availableCountries_master: index(local!regProjectCountries,wherecontains(local!availableCountryEREFs,local!regProjectCountries.REGION_EREF),
    - Maintain two separate variables namely local!availableCountries and local!globalActionCountries. Initialise these variables in load() as follows:
              local!availableCountries:local!availableCountries_master, /*should be available to Available Countries*/
              local!globalActionCountries: null, /*should be available to Global Action Countries*/
    - Perform addition or removal operations on local!availableCountries and local!globalActionCountries with reference to local!availableCountries_master as follows:

    a. Add All:
              - Empty local!availableCountries.
              - Populate local!globalActionCountries with local!availableCountries_master.
    b. Remove All:
              - Populate local!availableCountries with local!availableCountries_master.
              - Empty local!globalActionCountries.
    c. Select and add:
              - Update local!availableCountries with remove(local!availableCountries, selectedIndices)
              - Update local!globalActionCountries with local!availableCountries_master by removing the values of local!availableCountries.
    d. Select and remove:
              - Update local!globalActionCountries with remove(local!globalActionCountries, selectedIndices)
    - Update local!availableCountries with local!availableCountries_master by removing the values of local!globalActionCountries.
              
    While implementing the above approach, please do ensure that you are handling null values in the usage of set functions, value of a SAIL component etc.

    Please do let me know if you have any questions. Else I can help you in transforming the above steps into actual code.
Reply
  • I have gone through your code and I would like to put forward a simple approach in the form of a pseudocode and if you implement these steps, the underlying complexity in the code comes down and will be much easier to debug, maintain and in-fact the issue will be resolved:

    - Maintain a master copy of the data present in local!availableCountries, say local!availableCountries_master. Please don't make any modifications in this variable as this will be solely used as reference for addition and removals in the Available and Global Countries data.
              local!availableCountries_master: index(local!regProjectCountries,wherecontains(local!availableCountryEREFs,local!regProjectCountries.REGION_EREF),
    - Maintain two separate variables namely local!availableCountries and local!globalActionCountries. Initialise these variables in load() as follows:
              local!availableCountries:local!availableCountries_master, /*should be available to Available Countries*/
              local!globalActionCountries: null, /*should be available to Global Action Countries*/
    - Perform addition or removal operations on local!availableCountries and local!globalActionCountries with reference to local!availableCountries_master as follows:

    a. Add All:
              - Empty local!availableCountries.
              - Populate local!globalActionCountries with local!availableCountries_master.
    b. Remove All:
              - Populate local!availableCountries with local!availableCountries_master.
              - Empty local!globalActionCountries.
    c. Select and add:
              - Update local!availableCountries with remove(local!availableCountries, selectedIndices)
              - Update local!globalActionCountries with local!availableCountries_master by removing the values of local!availableCountries.
    d. Select and remove:
              - Update local!globalActionCountries with remove(local!globalActionCountries, selectedIndices)
    - Update local!availableCountries with local!availableCountries_master by removing the values of local!globalActionCountries.
              
    While implementing the above approach, please do ensure that you are handling null values in the usage of set functions, value of a SAIL component etc.

    Please do let me know if you have any questions. Else I can help you in transforming the above steps into actual code.
Children
No Data