Editable Grid

Certified Lead Developer

Is there any way to remove select all checkbox in editable grid?
we have requirement to select 1 item at a time. there is grid validation of selecting 1 item at time.
it shows error but is there any way to not even allowing to check the select all checkbox?

  Discussion posts and replies are publicly visible

Parents Reply Children
  • yes, I agree with , we can either set selectable value as false and create a new column and handling the validations
  • 0
    Certified Lead Developer
    in reply to TJ
    Thanks TJ
    I think this functionality can be achieved by taking new column with radio buttons, to select 1 item at a time.
  • Hi  

    The same functionality can be achieved without taking an additional column of radio button. 

    Single selection can be achieved by writing the below logic in selectionSaveInto.

    selectionValue: ri!selectedIndex_int,
    selectionSaveInto: {
    ri!selectedIndex_int,
    if(
    count(ri!selectedIndex_int)=count(local!items),
    a!save(ri!selectedIndex_int,1),
    if(count(ri!selectedIndex_int)>1,ri!selectedIndex_int<<ldrop(ri!selectedIndex_int,1),{})
    )
    }
    )

     

    Please check the code snippet attached. Let me know if it helps.

    Regards,

    Sidhant Behura

    =load(
      local!items: {
        {id:1, item: "Item 1", qty: 1, unitPrice: 10},
        {id:2, item: "Item 2", qty: 2, unitPrice: 20},
        {id:3, item: "Item 3", qty: 3, unitPrice: 30},
        {id:4, item: "Item 4", qty: 4, unitPrice: 40}
      },
      local!selected,
      a!gridLayout(
        label: "Grid Layout",
        instructions: "Selected: " & ri!selectedIndex_int,
        headerCells: {
          a!gridLayoutHeaderCell(label: "Item"),
          a!gridLayoutHeaderCell(label: "Qty", align: "RIGHT"),
          a!gridLayoutHeaderCell(label: "Unit Price", align: "RIGHT"),
          a!gridLayoutHeaderCell(label: "Total", align: "RIGHT")
        },
        rows: {
          a!forEach(
            items: local!items,
            expression: a!gridRowLayout(
            id: fv!index,
            contents: {
                a!textField(
                value: fv!item.item,
                saveInto: fv!item.item
              ),
              a!integerField(
                value: fv!item.qty,
                saveInto: fv!item.qty,
                align: "RIGHT"
              ),
              a!floatingPointField(
                value: fv!item.unitPrice,
                saveInto: fv!item.unitPrice,
                align: "RIGHT"
              ),
              a!textField(
                value: dollar(tointeger(fv!item.qty) * todecimal(fv!item.unitPrice)),
                readOnly: true,
                align: "RIGHT"
              )
            }
          )
            
          )
          
          
        },
        selectable: true,
        selectionValue: ri!selectedIndex_int,
        selectionSaveInto: {
          ri!selectedIndex_int,
          if(
            count(ri!selectedIndex_int)=count(local!items),
            a!save(ri!selectedIndex_int,1),
            if(count(ri!selectedIndex_int)>1,ri!selectedIndex_int<<ldrop(ri!selectedIndex_int,1),{})
          )
          
          
         }
      )
    )