pagination in layout grid without using foreach

Certified Senior Developer

how can we achive pagination in layout grid without using foreach?.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Maybe you can try this?

    if(
      or(
        ri!totalCount = 0,
        a!isNullOrEmpty(ri!totalCount)
      ),
      {},
      a!richTextDisplayField(
        align: "RIGHT",
        value: {
          a!richTextIcon(
            icon: "angle-double-left",
            size: "MEDIUM",
            link: a!dynamicLink(
              saveInto: { a!save(ri!pagingInfo.startIndex, 1) },
              showWhen: not(ri!pagingInfo.startIndex <= 1)
            ),
            color: if(
              ri!pagingInfo.startIndex <> 1,
              "STANDARD",
              "SECONDARY"
            ),
            linkStyle: "STANDALONE"
          ),
          a!richTextIcon(
            icon: "angle-left",
            size: "MEDIUM",
            link: a!dynamicLink(
              saveInto: {
                a!save(
                  ri!pagingInfo.startIndex,
                  ri!pagingInfo.startIndex - ri!pagingInfo.batchSize
                )
              },
              showWhen: not(ri!pagingInfo.startIndex <= 1)
            ),
            color: if(
              ri!pagingInfo.startIndex <> 1,
              "STANDARD",
              "SECONDARY"
            ),
            linkStyle: "STANDALONE"
          ),
          " ",
          a!richTextItem(
            text: {
              if(
                ri!totalCount > 0,
                { ri!pagingInfo.startIndex, "-" },
                ""
              ),
              if(
                ri!pagingInfo.startIndex + ri!pagingInfo.batchSize - 1 > ri!totalCount,
                ri!totalCount,
                ri!pagingInfo.startIndex + ri!pagingInfo.batchSize - 1
              )
            },
            size: "MEDIUM",
            style: "STRONG",
            
          ),
          a!richTextItem(
            text: {
              if(ri!totalCount > 0, " of ", ""),
              ri!totalCount
            },
            size: "MEDIUM"
          ),
          a!richTextIcon(
            icon: "angle-right",
            size: "MEDIUM",
            link: a!dynamicLink(
              saveInto: {
                a!save(
                  ri!pagingInfo.startIndex,
                  ri!pagingInfo.startIndex + ri!pagingInfo.batchSize
                )
              },
              showWhen: ri!totalCount >= ri!pagingInfo.startIndex + ri!pagingInfo.batchSize
            ),
            color: if(
              ri!pagingInfo.startIndex > (ri!totalCount - ri!pagingInfo.batchSize),
              "SECONDARY",
              "STANDARD"
            ),
            linkStyle: "STANDALONE"
          ),
          a!richTextIcon(
            icon: "angle-double-right",
            size: "MEDIUM",
            link: a!dynamicLink(
              saveInto: {
                a!save(
                  ri!pagingInfo.startIndex,
                  if(
                    mod(ri!totalCount, ri!pagingInfo.batchSize) = 0,
                    ri!totalCount - (ri!pagingInfo.batchSize) + 1,
                    (
                      floor(ri!totalCount / ri!pagingInfo.batchSize) * ri!pagingInfo.batchSize
                    ) + 1
                  )
                )
              },
              showWhen: ri!totalCount >= ri!pagingInfo.startIndex + ri!pagingInfo.batchSize
            ),
            color: if(
              ri!pagingInfo.startIndex > (ri!totalCount - ri!pagingInfo.batchSize),
              "SECONDARY",
              "STANDARD"
            ),
            linkStyle: "STANDALONE"
          )
        }
      )
    )

Reply
  • 0
    Certified Senior Developer

    Maybe you can try this?

    if(
      or(
        ri!totalCount = 0,
        a!isNullOrEmpty(ri!totalCount)
      ),
      {},
      a!richTextDisplayField(
        align: "RIGHT",
        value: {
          a!richTextIcon(
            icon: "angle-double-left",
            size: "MEDIUM",
            link: a!dynamicLink(
              saveInto: { a!save(ri!pagingInfo.startIndex, 1) },
              showWhen: not(ri!pagingInfo.startIndex <= 1)
            ),
            color: if(
              ri!pagingInfo.startIndex <> 1,
              "STANDARD",
              "SECONDARY"
            ),
            linkStyle: "STANDALONE"
          ),
          a!richTextIcon(
            icon: "angle-left",
            size: "MEDIUM",
            link: a!dynamicLink(
              saveInto: {
                a!save(
                  ri!pagingInfo.startIndex,
                  ri!pagingInfo.startIndex - ri!pagingInfo.batchSize
                )
              },
              showWhen: not(ri!pagingInfo.startIndex <= 1)
            ),
            color: if(
              ri!pagingInfo.startIndex <> 1,
              "STANDARD",
              "SECONDARY"
            ),
            linkStyle: "STANDALONE"
          ),
          " ",
          a!richTextItem(
            text: {
              if(
                ri!totalCount > 0,
                { ri!pagingInfo.startIndex, "-" },
                ""
              ),
              if(
                ri!pagingInfo.startIndex + ri!pagingInfo.batchSize - 1 > ri!totalCount,
                ri!totalCount,
                ri!pagingInfo.startIndex + ri!pagingInfo.batchSize - 1
              )
            },
            size: "MEDIUM",
            style: "STRONG",
            
          ),
          a!richTextItem(
            text: {
              if(ri!totalCount > 0, " of ", ""),
              ri!totalCount
            },
            size: "MEDIUM"
          ),
          a!richTextIcon(
            icon: "angle-right",
            size: "MEDIUM",
            link: a!dynamicLink(
              saveInto: {
                a!save(
                  ri!pagingInfo.startIndex,
                  ri!pagingInfo.startIndex + ri!pagingInfo.batchSize
                )
              },
              showWhen: ri!totalCount >= ri!pagingInfo.startIndex + ri!pagingInfo.batchSize
            ),
            color: if(
              ri!pagingInfo.startIndex > (ri!totalCount - ri!pagingInfo.batchSize),
              "SECONDARY",
              "STANDARD"
            ),
            linkStyle: "STANDALONE"
          ),
          a!richTextIcon(
            icon: "angle-double-right",
            size: "MEDIUM",
            link: a!dynamicLink(
              saveInto: {
                a!save(
                  ri!pagingInfo.startIndex,
                  if(
                    mod(ri!totalCount, ri!pagingInfo.batchSize) = 0,
                    ri!totalCount - (ri!pagingInfo.batchSize) + 1,
                    (
                      floor(ri!totalCount / ri!pagingInfo.batchSize) * ri!pagingInfo.batchSize
                    ) + 1
                  )
                )
              },
              showWhen: ri!totalCount >= ri!pagingInfo.startIndex + ri!pagingInfo.batchSize
            ),
            color: if(
              ri!pagingInfo.startIndex > (ri!totalCount - ri!pagingInfo.batchSize),
              "SECONDARY",
              "STANDARD"
            ),
            linkStyle: "STANDALONE"
          )
        }
      )
    )

Children
No Data