Column Groups

Optionally group columns together under a common header.


User Identification User Info
Username Company Name Last Visited At Role Visit Count Account Status
Kristy.Harris Langworth Group 10 Apr 2025 17:17:46 PDT admin 38 active
Anahi_Schmidt-Mills34 Kiehn-Labadie Inc 21 Jun 2025 13:30:20 PDT user 2 active
Lisette_Dare44 Goodwin - Grimes 12 Jun 2025 13:10:49 PDT admin 33 suspended
Kayleigh.Kirlin43 Rogahn, Stanton and Adams 16 Sep 2025 14:42:34 PDT admin 2 pending
Otis_Murazik Sauer, Pouros and Schamberger 05 Oct 2025 06:33:34 PDT admin 58 suspended
Regan_Kuhn Boyer, Hilpert and Friesen 07 Jan 2025 23:58:58 PDT moderator 45 suspended
Enoch_Spencer49 Pagac - Ryan 29 Sep 2025 12:58:28 PDT moderator 15 suspended
Jesus.Cremin Smith LLC 18 Jul 2025 12:39:34 PDT admin 26 active
Silas.Wiegand81 Marks and Sons 20 May 2024 14:10:45 PDT user 2 active
Emerald.Feest Ankunding, Ward and Krajcik 26 May 2025 23:27:07 PDT user 129 suspended
import {Component} from "@angular/core"

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

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

@Component({
  imports: [TableModule, ButtonModule, ProgressRingModule],
  selector: "column-grouping-demo",
  template: `
    <div q-table-root>
      <div q-table-action-bar>
        <button q-button variant="outline" (click)="query.refetch()">
          Regenerate
        </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
                    class="text-center"
                    q-table-header-cell
                    [colSpan]="header.colSpan"
                  >
                    @if (!header.isPlaceholder) {
                      <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>
  `,
})
export class ColumnGroupingDemo {
  readonly query = createUserQuery(10)

  protected table: AngularTable<User> = createAngularTable(() => ({
    columns,
    data: this.query.data() || [],
    getCoreRowModel: getCoreRowModel(),
  }))
}
Updated by Ryan Bower