On top of what Danny proposed as a solution, you can create the pagination functionality itself as a common component for use also in other Grids.
You only have to create a generic interface with only 3 rule inputs:
startIndex (int): pass the pagingInfo.startIndex,
batchSize (int): pass the pagingInfo.batshSize,
totalCount (int): pass the local!datasubset.data
and make a call of this common interface after your grid and you will be fine.
a!localVariables(
a!sideBySideLayout(
items: {
a!sideBySideItem(
item: a!richTextDisplayField(
align: "RIGHT",
value: {
/* Left Angle */
a!richTextIcon(
icon: "angle-double-left",
link: a!dynamicLink(
saveInto: {
a!save(ri!startIndex, 1),
},
showWhen: ri!startIndex <> 1
),
linkStyle: "STANDALONE",
color: if(
ri!startIndex <> 1,
"STANDARD",
"SECONDARY"
)
),
a!richTextIcon(
icon: "angle-left",
link: a!dynamicLink(
showWhen: ri!startIndex <> 1,
saveInto: a!save(
ri!startIndex,
ri!startIndex - ri!batchSize
)
),
linkStyle: "STANDALONE",
color: if(
ri!startIndex <> 1,
"STANDARD",
"SECONDARY"
)
),
/* Start Index */
a!richTextItem(
text: {
ri!startIndex,
" - ",
if(
ri!startIndex + ri!batchSize - 1 > ri!totalCount,
ri!totalCount,
ri!startIndex + ri!batchSize - 1
)
},
style: "STRONG"
),
/* Total Count */
a!richTextItem(
text: {
" of ",
ri!totalCount
}
),
/* Right Angle */
a!richTextIcon(
icon: "angle-right",
link: a!dynamicLink(
showWhen: (ri!startIndex + ri!batchSize - 1) < ri!totalCount,
label: "",
saveInto: a!save(
ri!startIndex,
ri!startIndex + ri!batchSize
)
),
linkStyle: "STANDALONE",
color: if(
ri!startIndex + ri!batchSize - 1 < ri!totalCount,
"STANDARD",
"SECONDARY"
)
),
a!richTextIcon(
icon: "angle-double-right",
link: a!dynamicLink(
saveInto: {
a!save(
ri!startIndex,
if(
mod(ri!totalCount, ri!batchSize) = 0,
ri!totalCount - ri!batchSize + 1,
ri!totalCount - mod(ri!totalCount, ri!batchSize) + 1
)
)
},
showWhen: ri!startIndex + ri!batchSize - 1 < ri!totalCount
),
linkStyle: "STANDALONE",
color: if(
ri!startIndex + ri!batchSize - 1 < ri!totalCount,
"STANDARD",
"SECONDARY"
)
)
}
)
)
}
)
)