Skip to main content
January 6, 2025
Question

multiple drop down same time multi select updating one at a time

  • January 6, 2025
  • 4 replies
  • 0 views

a!localVariables(
  local!items: {
    a!map(id: 1, value: "a|b"),
    a!map(id: 6, value: "a|b"),
    a!map(id: 8, value: "a|b")
  },
  local!sortedData: {
    a!map(id: 8, value: { "a", "b" }),
    a!map(id: 2, value: { "a", "b" }),
    a!map(id: 8, value: { "a", "b" })
  },
  a!columnsLayout(
    columns: {
      a!columnLayout(
        contents: {
          a!forEach(
            local!sortedData,
            if(
              mod(fv!index, 2) <> 0,
              a!multipleDropdownField(
                label: "Item" & fv!index,
                choiceValues: { "a", "b", "c", "d" },
                choiceLabels: { "a", "b", "c", "d" },
                value: touniformstring(fv!item.value),
                saveInto: {
                  fv!item.value,
                  a!save(
                    local!sortedData,
                    append(
                      local!sortedData,
                      a!map(
                        id: count(local!sortedData) - 2,
                        value: null
                      )
                    )
                  ),
                  a!save(
                    local!sortedData,
                    todatasubset(
                      local!sortedData,
                      a!pagingInfo(
                        1,
                        - 1,
                        a!sortInfo(field: "id", ascending: true())
                      )
                    ).data,
                    
                  )
                }
              ),
              {}
            )
          )
        }
      ),
      a!columnLayout(
        contents: {
          a!forEach(
            local!sortedData,
            if(
              mod(fv!index, 2) = 0,
              a!multipleDropdownField(
                label: "Item" & fv!index,
                choiceValues: { "a", "b", "c", "d" },
                choiceLabels: { "a", "b", "c", "d" },
                value: touniformstring(fv!item.value),
                saveInto: {
                  fv!item.value,
                  a!save(
                    local!sortedData,
                    append(
                      local!sortedData,
                      a!map(
                        id: count(local!sortedData) + 1,
                        value: null
                      )
                    )
                  ),
                  a!save(
                    local!sortedData,
                    todatasubset(
                      local!sortedData,
                      a!pagingInfo(
                        1,
                        - 1,
                        a!sortInfo(field: "id", ascending: true())
                      )
                    ).data,
                    
                  )
                }
              ),
              {}
            )
          )
        }
      )
    }
  )
)

When i select multiple values at same time in multipledropdown, as its updating the local!sorteddata ,its takes only one value to process. Can we keep any hold to process all selected values at same time? or any workarounds

4 replies

mikes0011
Brainy
January 6, 2025

I'm a little confused - what exaclty are you trying to accomplish?

January 6, 2025

each value selected in multiple dropdown can link to another value, when you select that option respective linked value will be added to the parent and becomes another component which is working fine with single selection but when i multi select same time eventhough we select multiple it process one at a time instead of all together. 

Here in the example for each items in the map i want multipledropdown, when i select value in multi select dropdown, i'm updating the parent adding one item to parent which will work fine but i do multi select at same time it save one at a time

stefanhelzle0001
January 7, 2025

Same here, I do not understand what you want to achieve.

You write "one at a time". Sure, each selection is an individual interaction with the component and results in an evaluation of your saveInto configuration.