How much to Query when displaying a few rows at a time in a read-only grid?

Suppose I have a database table 100,000 entries large, and I want to display them in a read-only grid 25 at a time.

How can I achieve this, without having to query everything at once?

It seems that if I query using the page size (here, 25) then the read-only grid does not have an arrow allowing you to move to the next page, presumably because it thinks it is displaying everything. However, since the read-only grid does not have a totalCount parameter, I am unsure of how I can tell the read-only grid that there are still more rows to be queried and displayed.

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Manual paging shouldn't be necessary in this case - the standard method of adding the query to the data parameter and using fv!pagingInfo should allow you to query 25 items at a time.

    Here's an example: 

    a!gridField(
        label: "Read-only Grid",
        labelPosition: "ABOVE",
        data: a!queryEntity(
          entity: cons!EMPLOYEE_ENTITY,
          query: a!query(
            selection: a!querySelection(
              columns: {
                a!queryColumn(
                  field: "id"
                ),
                a!queryColumn(
                  field: "firstName"
                ),
                a!queryColumn(
                  field: "lastName"
                ),
                a!queryColumn(
                  field: "department"
                ),
                a!queryColumn(
                  field: "startDate"
                )
              }
            ),
            pagingInfo: fv!pagingInfo
          ),
          fetchTotalCount: true
        ),
        columns: {
          a!gridColumn(
            label: "First Name",
            sortField: "firstName",
            value: fv!row.firstName
          ),
          a!gridColumn(
            label: "Last Name",
            sortField: "lastName",
            value: fv!row.lastName
          ),
          a!gridColumn(
            label: "Department",
            sortField: "department",
            value: fv!row.department
          ),
          a!gridColumn(
            label: "Start Date",
            sortField: "startDate",
            value: fv!row.startDate,
            align: "END"
          )
        },
        pagesize: 25,
        initialsorts: {
          a!sortInfo(
            field: "lastName",
            ascending: true
          )
        }
    )