Issue in editable grid bulk selection

Certified Senior Developer

Hi All,

I am having editable grid with selection and implemented pagination also for that grid. For selection given primary key for id in gridRowLayout.

but issue is if I selected all records in first page by click on header level checkbox and and go to next page and select all rows there also in same manner then my first page all selected primary keys is replacing with second page selected primary keys instead of appending all the selected primary key.

Please help in this

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Senior Developer
    in reply to Mike Schmitt

    Thanks for the response, Mike...

    I have tried to append instead of override. It is appending the next page selected all IDs, but when I try to deselect any row, that is not happening. It is always being selected. 

    I tried like this.

    selectionValue: local!selectedIndices,
            selectionSaveInto: if(
              a!isNullOrEmpty(local!selectedIndices),
              a!save(
                local!selectedIndices,
                a!flatten(save!value)
              ),
              a!save(
                local!selectedIndices,
                append(
                  local!selectedIndices,
                  a!flatten(save!value)
                )
              )
            )

Children
  • 0
    Certified Senior Developer
    in reply to ganeshg0004

    Hi  

    The issue is with the "Select All" functionality. When you select all values using it and then navigate to the next page and select all again, it overrides the previously selected values. However, this issue does not occur if you manually select each value one by one, move to the next page, and continue the same process — in that case, the select and deselect functionality works as expected.

    I would suggest the following options to resolve this:

    1. Build a custom "Select All" functionality.

    2. Alternatively, change the selection style to ROW_HIGHLIGHT.

    selectionValue: local!selectedIndices,
    selectionSaveInto: a!save(
              local!selectedIndices,
              a!flatten(save!value)
            ),
    selectionStyle: "ROW_HIGHLIGHT"

  • 0
    Certified Senior Developer
    in reply to Vyshnavi Naripeddi

    Thanks Vyshnavi, for the suggestion...

    I have fixed this issue by applying a condition for "select all" and "deselect all" in the selection save into as per below

     selectionValue: local!selectedIndices,
            selectionSaveInto: a!save(
              local!selectedIndices,
              if(
                a!isNullOrEmpty(index(save!value,1,null)),
                difference(local!selectedIndices,local!gridData.data.id),
                if(
                  length(wherecontains(local!gridData.data.id,tointeger(save!value)))=length(local!gridData.data),
                  union(append(local!selectedIndices,a!flatten(save!value)),append(local!selectedIndices,a!flatten(save!value)))
                  a!flatten(save!value)
                )
              )
            ),