Editable Grid

Certified Senior Developer

How to disable all the remaining checkboxes while we select one checkbox in Editable grid ?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Try this example

    a!localVariables(
      local!employees: {
        a!map(id: 1, name: "Ravi", role: "Developer"),
        a!map(id: 2, name: "Priya", role: "Tester"),
        a!map(id: 3, name: "Arun", role: "Manager")
      },
      local!selectedRow: {},
    
      a!gridLayout(
        label: "Select Only One Row",
        headerCells: {
          a!gridLayoutHeaderCell(label: "Name"),
          a!gridLayoutHeaderCell(label: "Role")
        },
        rows: a!forEach(
          items: local!employees,
          expression: a!gridRowLayout(
            id: fv!item.id,
            contents: {
              a!textField(
                value: fv!item.name,
                readOnly: true
              ),
              a!textField(
                value: fv!item.role,
                readOnly: true
              )
            },
            selectionDisabled: and(
              length(local!selectedRow) > 0,
              not(contains(local!selectedRow, fv!item.id))
            )
          )
        ),
        selectable: true,
        selectionValue: local!selectedRow,
        selectionSaveInto: a!save(local!selectedRow, a!flatten(save!value))
      )
    )

Reply
  • 0
    Certified Lead Developer

    Try this example

    a!localVariables(
      local!employees: {
        a!map(id: 1, name: "Ravi", role: "Developer"),
        a!map(id: 2, name: "Priya", role: "Tester"),
        a!map(id: 3, name: "Arun", role: "Manager")
      },
      local!selectedRow: {},
    
      a!gridLayout(
        label: "Select Only One Row",
        headerCells: {
          a!gridLayoutHeaderCell(label: "Name"),
          a!gridLayoutHeaderCell(label: "Role")
        },
        rows: a!forEach(
          items: local!employees,
          expression: a!gridRowLayout(
            id: fv!item.id,
            contents: {
              a!textField(
                value: fv!item.name,
                readOnly: true
              ),
              a!textField(
                value: fv!item.role,
                readOnly: true
              )
            },
            selectionDisabled: and(
              length(local!selectedRow) > 0,
              not(contains(local!selectedRow, fv!item.id))
            )
          )
        ),
        selectable: true,
        selectionValue: local!selectedRow,
        selectionSaveInto: a!save(local!selectedRow, a!flatten(save!value))
      )
    )

Children
No Data