Pagination (Client-side)

This page features a client-side pagination demo that fetches all data up front. Refer to the Pagination Guide for a detailed explanation. For server-side pagination, refer to the Server-side Pagination Example.

The demo below loads 10,000 rows and uses getPaginationRowModel to handle page slicing automatically. It integrates the Pagination component to provide page navigation buttons, configurable page sizes, and a page range indicator showing the current row range and total count.

Note that the table pagination uses the q-table-pagination directive. Its API is identical to the q-pagination-root directive.


Username Role Account Status Account Created On Last Visited At Visit Count
Kian_OConnell25 admin pending 19 Oct 2024 07:23:53 PDT 19 Sep 2025 08:09:36 PDT 124
Mafalda_Hills admin pending 02 Jul 2025 10:09:48 PDT 14 Jul 2025 00:49:41 PDT 2
Merl.Aufderhar moderator active 20 Jul 2024 10:50:50 PDT 24 May 2025 10:54:40 PDT 142
Mozell.Mraz user pending 20 Jan 2025 14:07:43 PDT 28 Mar 2025 18:32:08 PDT 117
Alda.Hintz moderator suspended 05 Nov 2024 16:02:28 PDT 13 Feb 2025 03:38:11 PDT 21
Gia_Dickens admin active 07 Dec 2024 13:27:57 PDT 18 Feb 2025 18:53:07 PDT 81
Merl.Langosh user active 24 Dec 2024 03:59:51 PDT 23 Jul 2025 06:50:02 PDT 296
Houston_Morar user suspended 23 Jan 2024 02:15:06 PDT 02 Feb 2024 04:10:23 PDT 2
Glenda.Dach user pending 27 Oct 2024 03:02:37 PDT 16 Feb 2025 03:10:55 PDT 5
Everardo_Little admin pending 07 Jul 2024 20:14:26 PDT 22 Jul 2024 07:56:20 PDT 2
import {Component, signal} from "@angular/core"
import {FormsModule} from "@angular/forms"

import {ButtonModule} from "@qualcomm-ui/angular/button"
import {PaginationModule} from "@qualcomm-ui/angular/pagination"
import {ProgressRingModule} from "@qualcomm-ui/angular/progress-ring"
import {
  type AngularTable,
  createAngularTable,
  createTablePagination,
  TableModule,
} from "@qualcomm-ui/angular/table"
import {
  getCoreRowModel,
  getFilteredRowModel,
  getPaginationRowModel,
} from "@qualcomm-ui/core/table"

import {createUserQuery, type User, userColumns} from "./data"

@Component({
  imports: [
    TableModule,
    PaginationModule,
    ButtonModule,
    ProgressRingModule,
    FormsModule,
  ],
  selector: "pagination-demo",
  template: `
    <div q-table-root>
      <div q-table-action-bar>
        <button
          q-button
          size="sm"
          variant="outline"
          [disabled]="query.isFetching()"
          (click)="query.refetch()"
        >
          Refresh Data
        </button>
        @if (query.isFetching()) {
          <div q-progress-ring size="xs"></div>
        }
      </div>
      <div q-table-scroll-container>
        <table q-table-table>
          <thead q-table-header>
            @for (
              headerGroup of table.getHeaderGroups();
              track headerGroup.id
            ) {
              <tr q-table-row>
                @for (header of headerGroup.headers; track header.id) {
                  <th q-table-header-cell>
                    <ng-container *renderHeader="header; let value">
                      {{ value }}
                    </ng-container>
                  </th>
                }
              </tr>
            }
          </thead>
          <tbody q-table-body>
            @for (row of table.getRowModel().rows; track row.id) {
              <tr q-table-row>
                @for (cell of row.getVisibleCells(); track cell.id) {
                  <td q-table-cell>
                    <ng-container *renderCell="cell; let value">
                      {{ value }}
                    </ng-container>
                  </td>
                }
              </tr>
            }
          </tbody>
        </table>
      </div>
      <div
        q-table-pagination
        [count]="pagination.count()"
        [page]="pagination.page()"
        [pageSize]="pagination.pageSize()"
        (pageChanged)="pagination.onPageChange($event)"
      >
        <div *paginationContext="let context" q-pagination-page-metadata>
          @let meta = context.pageMetadata;
          {{ meta.pageStart }}-{{ meta.pageEnd }} of {{ meta.count }} results
        </div>

        <div q-pagination-page-buttons></div>
      </div>
    </div>
  `,
})
export class PaginationClientSideDemo {
  readonly globalFilter = signal<string>("")
  protected readonly query = createUserQuery(1200)

  protected table: AngularTable<User> = createAngularTable(() => ({
    columns: userColumns,
    data: this.query.data() || [],
    getCoreRowModel: getCoreRowModel(),
    getFilteredRowModel: getFilteredRowModel(),
    getPaginationRowModel: getPaginationRowModel(),
  }))

  protected pagination = createTablePagination(this.table)
}
Updated by Ryan Bower