Select only one choice in grid selection

Hello,

I'd like to be able to select only one choice in a grid selection at the same time.
Is there a way to force that?

OriginalPostID-202357

OriginalPostID-202357

  Discussion posts and replies are publicly visible

Parents
  • You can try the below approach:
    In validations of a!gridField() component, use the logic

    if(count(local!gridSelection.selected)>1, "You can select only one choice", null)

    Also in saveInto, use the logic

    {
    local!gridSelection,
    if(
    count(local!gridSelection.selected)>1,
    {},
    a!save(local!selectedEmployeeId, index(save!value, "selected", null))
    )
    }


    Where local!gridSelection is
    a!gridSelection(
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 20,
    sort: a!sortInfo(
    field: "fieldName",
    ascending: true/false
    )
    )
    )
Reply
  • You can try the below approach:
    In validations of a!gridField() component, use the logic

    if(count(local!gridSelection.selected)>1, "You can select only one choice", null)

    Also in saveInto, use the logic

    {
    local!gridSelection,
    if(
    count(local!gridSelection.selected)>1,
    {},
    a!save(local!selectedEmployeeId, index(save!value, "selected", null))
    )
    }


    Where local!gridSelection is
    a!gridSelection(
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 20,
    sort: a!sortInfo(
    field: "fieldName",
    ascending: true/false
    )
    )
    )
Children
No Data