GridField total count not showing below 5

Hi All,

Thanks in advance

gridField total count is not showing up if the list count is less than 5 ? Is it a default behaviour or can be configured?

Thanks

Rajesh

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Lead Developer

    Hi Rajesh,

    The total count and pagination is only shown when your batchSize for the pagingInfo is smaller than the data which grid is showing (totalCount).

    If you want to display this you can create a common section consisting of the if - block below, and use it below the grids where you might need this.

    This will render a section below the grid when above condition is not true comprising of images (for navigation) and  totalCount. Similar to what is rendered in the pagination for grid

     

    load(
      local!paginginfo: a!pagingInfo(
        startIndex: 1,
        batchSize: 6,
        sort: {}
      ),
      local!dataToDisplay: todatasubset(
        updatearray(
          {},
          5,
          0
        )
      ),
      {
        if(
          and(
            local!pagingInfo.batchSize < local!dataToDisplay.totalCount,
            local!pagingInfo.batchSize <> - 1
          ),
          {},
          a!richTextDisplayField(
            value: {
              a!richTextImage(
                a!webImage(
                  source: "/suite/components/img/firstpage_disabled.gif"
                )
              ),
              a!richTextImage(
                a!webImage(
                  source: "/suite/components/img/prev_disabled.gif"
                )
              ),
              a!richTextItem(
                text: local!pagingInfo.startIndex & " - " & local!dataToDisplay.totalCount & " of " & local!dataToDisplay.totalCount & " "
              ),
              a!richTextImage(
                a!webImage(
                  source: "/suite/components/img/next_disabled.gif"
                )
              ),
              a!richTextImage(
                a!webImage(
                  source: "/suite/components/img/lastpage_disabled.gif"
                )
              )
            }
          )
        )
      }
    )

     

    You can test this an interface for different scenarios by changing your local!paginginfo.batchSize

    Remember, this might be an overhead and you can avoid it if it is not a must to do.

Reply
  • +1
    Certified Lead Developer

    Hi Rajesh,

    The total count and pagination is only shown when your batchSize for the pagingInfo is smaller than the data which grid is showing (totalCount).

    If you want to display this you can create a common section consisting of the if - block below, and use it below the grids where you might need this.

    This will render a section below the grid when above condition is not true comprising of images (for navigation) and  totalCount. Similar to what is rendered in the pagination for grid

     

    load(
      local!paginginfo: a!pagingInfo(
        startIndex: 1,
        batchSize: 6,
        sort: {}
      ),
      local!dataToDisplay: todatasubset(
        updatearray(
          {},
          5,
          0
        )
      ),
      {
        if(
          and(
            local!pagingInfo.batchSize < local!dataToDisplay.totalCount,
            local!pagingInfo.batchSize <> - 1
          ),
          {},
          a!richTextDisplayField(
            value: {
              a!richTextImage(
                a!webImage(
                  source: "/suite/components/img/firstpage_disabled.gif"
                )
              ),
              a!richTextImage(
                a!webImage(
                  source: "/suite/components/img/prev_disabled.gif"
                )
              ),
              a!richTextItem(
                text: local!pagingInfo.startIndex & " - " & local!dataToDisplay.totalCount & " of " & local!dataToDisplay.totalCount & " "
              ),
              a!richTextImage(
                a!webImage(
                  source: "/suite/components/img/next_disabled.gif"
                )
              ),
              a!richTextImage(
                a!webImage(
                  source: "/suite/components/img/lastpage_disabled.gif"
                )
              )
            }
          )
        )
      }
    )

     

    You can test this an interface for different scenarios by changing your local!paginginfo.batchSize

    Remember, this might be an overhead and you can avoid it if it is not a must to do.

Children