how we can apply pagination on grid layout

i wanted to apply pagination on grid layout, can we do that?

  Discussion posts and replies are publicly visible

Parents
  • Hi Lokesh,

    Grid Layout don't allow to add pagingInfo in it but there is a workaround for it.
    You can user richtextfileds and dynamical links to achieve this.

    Please go through below code, add this after your gridLayout Code.

    a!richTextDisplayField(
    value: {
    a!richTextItem_18r1(
    text: "<",
    link: a!dynamicLink(
    saveInto: {
    a!save(
    ri!pagingInfo.startIndex,
    ri!pagingInfo.startIndex-ri!pagingInfo.batchSize)

    }
    ),
    showWhen: not(
    ri!pagingInfo.startIndex <= 1
    )
    ),
    " ",
    if(
    ri!data.totalCount > 0,
    {
    ri!pagingInfo.startIndex,
    " - "
    },
    ""
    ),
    if(
    ri!pagingInfo.startIndex + ri!pagingInfo.batchSize - 1 > ri!data.totalCount,
    ri!data.totalCount,
    ri!pagingInfo.startIndex + ri!pagingInfo.batchSize - 1
    ),
    if(
    ri!data.totalCount > 0,
    " of ",
    ""
    ),
    ri!data.totalCount,
    if(
    ri!data.totalCount > 0,
    " items ",
    ""
    ),
    a!richTextItem_18r1(
    text: ">",
    link: a!dynamicLink(
    saveInto: {
    a!save(
    ri!pagingInfo.startIndex,
    ri!pagingInfo.startIndex + ri!pagingInfo.batchSize
    )
    }
    ),
    showWhen: (
    ri!data.totalCount >= ri!pagingInfo.startIndex + ri!pagingInfo.batchSize
    )
    )
    },
    align: "RIGHT"
    )
  • the logic works fine in normal scenario, but there is one problem, here, once you want to add a new dynamic row, then it fails as we are adding the new row data to the data-subset and data-subset is defined in with() (to refresh the data on change of pagination), so it fails as variable under with() cant be saved.
Reply Children