Hiding options from dropdown values

We have an editable grid, in the second column if the user selects "primary" on more than one row; the grid displays an error.

Is there a way to hide the "Primary" option from the consequent dropdown values; if the user selects "Primary" on any of the columns?



OriginalPostID-216959

OriginalPostID-216959

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    in reply to vinayp0002

    Here is a sample code logic that can do the same. Ensure you refine the code as you want and apply necessary best practices

    a!localVariables(
      local!choiceValues: { "Primary", "Choice 2", "Choice 3" },
      local!selectedRoles: {},
      {
        a!gridLayout(
          label: "Editable Grid",
          labelPosition: "ABOVE",
          headerCells: {
            a!gridLayoutHeaderCell(label: "Header Cell")
          },
          columnConfigs: {},
          rows: a!forEach(
            items: local!selectedRoles,
            expression: {
              a!gridRowLayout(
                contents: {
                  a!dropdownField(
                    label: "Ownership Role",
                    placeholder: "Select",
                    choiceLabels: difference(
                      local!choiceValues,
                      difference(local!selectedRoles, fv!item)
                    ),
                    choiceValues: difference(
                      local!choiceValues,
                      difference(local!selectedRoles, fv!item)
                    ),
                    value: fv!item,
                    saveInto: fv!item
                  )
                }
              )
            }
          ),
          selectionSaveInto: {},
          validations: {},
          addRowLink: a!dynamicLink(
            label: "Add Row",
            saveInto: {
              a!save(
                local!selectedRoles,
                touniformstring(append(local!selectedRoles, null))
              )
            }
          ),
          shadeAlternateRows: true
        )
      }
    )

Reply
  • 0
    Certified Lead Developer
    in reply to vinayp0002

    Here is a sample code logic that can do the same. Ensure you refine the code as you want and apply necessary best practices

    a!localVariables(
      local!choiceValues: { "Primary", "Choice 2", "Choice 3" },
      local!selectedRoles: {},
      {
        a!gridLayout(
          label: "Editable Grid",
          labelPosition: "ABOVE",
          headerCells: {
            a!gridLayoutHeaderCell(label: "Header Cell")
          },
          columnConfigs: {},
          rows: a!forEach(
            items: local!selectedRoles,
            expression: {
              a!gridRowLayout(
                contents: {
                  a!dropdownField(
                    label: "Ownership Role",
                    placeholder: "Select",
                    choiceLabels: difference(
                      local!choiceValues,
                      difference(local!selectedRoles, fv!item)
                    ),
                    choiceValues: difference(
                      local!choiceValues,
                      difference(local!selectedRoles, fv!item)
                    ),
                    value: fv!item,
                    saveInto: fv!item
                  )
                }
              )
            }
          ),
          selectionSaveInto: {},
          validations: {},
          addRowLink: a!dynamicLink(
            label: "Add Row",
            saveInto: {
              a!save(
                local!selectedRoles,
                touniformstring(append(local!selectedRoles, null))
              )
            }
          ),
          shadeAlternateRows: true
        )
      }
    )

Children
No Data