Skip to main content
December 13, 2024
Question

selections for editable grid in pagination

  • December 13, 2024
  • 4 replies
  • 0 views

hi, 

I have implemented pagination for an editable grid, but when i select a first row and move to next page the selection remain same , though the row data is different

Page1 , i choose the first row

Page 2 - first row is automatically selected

how do I control the selection in pagination ,

local!listPagingInfo: a!pagingInfo(startIndex: 1, batchSize: 20),
local!pagedList: rule!getData(Id: local!search,pagingInfo: local!listPagingInfo)

a!gridLayout(

labelPosition: "ABOVE",
totalCount: null,
headerCells: {},
columnConfigs: {},
rows: {},

selectionValue: local!selectedIndex,
selectionSaveInto: {
a!save(
local!selectedIndex,
a!flatten(save!value)
),
a!save(
ri!selecteditems,
if(
a!isNullOrEmpty(local!selectedIndex),
{},
index(
local!pagedList,
local!selectedIndex
)
)
)

},
/*selectionRequired: true,*/
selectable: true,
selectionStyle: "CHECKBOX",
validations: {},
shadeAlternateRows: true,
borderStyle: "STANDARD",
rowHeader: 1
),

    4 replies

    mikes0011
    Brainy
    December 13, 2024

    This is because you're selecting the row by index (its position in the current page's worth of data) as opposed to by its unique ID.  To fix this you'll need to rework how your selection is handled.

    Also:

    December 13, 2024

    Thanks Mike, is there any reference available.

    mikes0011
    Brainy
    December 13, 2024

    I would just point you to the documentation pages for the editable grid.  I would suggest using the "id" functionality inside a!gridRowLayout(), and point it to a primary key instead of using the row's position.  Alas, I don't usually go through the painful process of manually building paging for editable grids, so my specific advice stops there.  But you seem to know how to manually manage saveInto parameters and so-forth, so I would warrant it won't be too difficult for you to rework.

    December 26, 2024

    We can refer primary key instead of fv!index for grid selection. Adding sample code for your reference. Here id is my primary key