grid deselection at header level doesnt work

Certified Associate Developer

hi, 

I have an editable grid and have selection enabled, it works perfectly fine , when selecting individual rows and as bulk when i chose the check box in the header, 

This works 

when i unselect at header , it throws error but individual row deselection works, only deselection in the header is not working 

code :at line 507

selectionValue: local!selectedIndex,
selectionSaveInto: {
local!selectedIndex,a!save(local!selectedrows,index(local!displayItems,local!selectedIndex))},

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Associate Developer

    Hi  ,

    just try this logic

    a!localVariables(
      local!items: {
        { item: "Item 1", qty: 1, unitPrice: 10 },
        { item: "Item 2", qty: 2, unitPrice: 20 }
      },
      local!selecteditems,
      a!gridLayout(
        label: "Products",
        instructions: "Selected: ",
        headerCells: {
          a!gridLayoutHeaderCell(label: "Item"),
          a!gridLayoutHeaderCell(label: "Qty"),
          a!gridLayoutHeaderCell(label: "Unit Price"),
          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),
              a!floatingPointField(
                value: fv!item.unitPrice,
                saveInto: fv!item.unitPrice
              ),
              a!textField(
                value: a!currency(
                  isoCode: "USD",
                  value: tointeger(fv!item.qty) * todecimal(fv!item.unitPrice)
                ),
                readOnly: true,
                align: "RIGHT"
              )
            }
          )
        ),
        selectable: true(),
        selectionValue: local!selecteditems,
        selectionSaveInto: a!save(
          local!selecteditems,
          a!flatten(save!value)
        ),
        rowHeader: 1
      )
    )
    , i think this can help you to achieve your requirement.

Reply
  • 0
    Certified Associate Developer

    Hi  ,

    just try this logic

    a!localVariables(
      local!items: {
        { item: "Item 1", qty: 1, unitPrice: 10 },
        { item: "Item 2", qty: 2, unitPrice: 20 }
      },
      local!selecteditems,
      a!gridLayout(
        label: "Products",
        instructions: "Selected: ",
        headerCells: {
          a!gridLayoutHeaderCell(label: "Item"),
          a!gridLayoutHeaderCell(label: "Qty"),
          a!gridLayoutHeaderCell(label: "Unit Price"),
          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),
              a!floatingPointField(
                value: fv!item.unitPrice,
                saveInto: fv!item.unitPrice
              ),
              a!textField(
                value: a!currency(
                  isoCode: "USD",
                  value: tointeger(fv!item.qty) * todecimal(fv!item.unitPrice)
                ),
                readOnly: true,
                align: "RIGHT"
              )
            }
          )
        ),
        selectable: true(),
        selectionValue: local!selecteditems,
        selectionSaveInto: a!save(
          local!selecteditems,
          a!flatten(save!value)
        ),
        rowHeader: 1
      )
    )
    , i think this can help you to achieve your requirement.

Children
No Data