Column Sizing
Click and drag the resize handle to resize columns.
Username | Role | Account Status | Account Created On | Last Visited At | Visit Count |
|---|---|---|---|---|---|
| Vito_Wiza | admin | active | 22 Apr 2025 11:55:48 PDT | 02 Sep 2025 09:59:42 PDT | 5 |
| Sonia.Nienow | moderator | active | 07 May 2024 21:16:07 PDT | 31 Jan 2025 18:02:24 PDT | 30 |
| Devin.Johnston | moderator | suspended | 25 Aug 2025 19:37:37 PDT | 28 Oct 2025 16:06:44 PDT | 341 |
| Brian_Skiles86 | moderator | pending | 29 Feb 2024 07:12:23 PDT | 18 Jul 2025 04:00:07 PDT | 136 |
| Americo.Hayes | admin | active | 19 Sep 2024 16:31:53 PDT | 07 Jan 2025 06:30:11 PDT | 8 |
import {Component, computed, signal} from "@angular/core"
import {FormsModule} from "@angular/forms"
import {ButtonModule} from "@qualcomm-ui/angular/button"
import {ProgressRingModule} from "@qualcomm-ui/angular/progress-ring"
import {RadioModule} from "@qualcomm-ui/angular/radio"
import {
type AngularTable,
createAngularTable,
TableModule,
} from "@qualcomm-ui/angular/table"
import {
type ColumnResizeDirection,
type ColumnResizeMode,
getCoreRowModel,
} from "@qualcomm-ui/core/table"
import {columns, createUserQuery, type User} from "./data"
@Component({
imports: [
TableModule,
ButtonModule,
ProgressRingModule,
RadioModule,
FormsModule,
],
selector: "column-sizing-demo",
template: `
<div class="flex w-full flex-col gap-4 p-2">
<div q-table-root showColumnDivider>
<div class="gap-8" q-table-action-bar>
<button q-button variant="outline" (click)="query.refetch()">
Regenerate
</button>
<fieldset
name="resizeMode"
orientation="horizontal"
q-radio-group
[(ngModel)]="columnResizeMode"
>
<div q-radio-group-label>Resize</div>
<div q-radio-group-items>
<label label="onChange" q-radio value="onChange"></label>
<label label="onEnd" q-radio value="onEnd"></label>
</div>
</fieldset>
<fieldset
name="direction"
orientation="horizontal"
q-radio-group
[(ngModel)]="columnResizeDirection"
>
<div q-radio-group-label>Direction</div>
<div q-radio-group-items>
<label label="ltr" q-radio value="ltr"></label>
<label label="rtl" q-radio value="rtl"></label>
</div>
</fieldset>
</div>
<div q-table-scroll-container>
<table
q-table-table
[attr.dir]="columnResizeDirection()"
[style.width.px]="table().getCenterTotalSize()"
>
<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="relative text-justify"
q-table-header-cell
[colSpan]="header.colSpan"
[style.width.px]="header.getSize()"
>
<div
class="inline-flex w-full items-center justify-between gap-4"
>
@if (!header.isPlaceholder) {
<ng-container *renderHeader="header; let value">
{{ value }}
</ng-container>
}
<div
q-table-column-resize-handle
[header]="header"
></div>
</div>
</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 [style.width.px]="cell.column.getSize()">
<ng-container *renderCell="cell; let value">
{{ value }}
</ng-container>
</td>
}
</tr>
}
</tbody>
</table>
</div>
</div>
</div>
`,
})
export class ColumnSizingDemo {
protected readonly query = createUserQuery(5)
protected readonly columnResizeMode = signal<ColumnResizeMode>("onChange")
protected readonly columnResizeDirection =
signal<ColumnResizeDirection>("ltr")
protected readonly table = computed<AngularTable<User>>(() =>
createAngularTable(() => ({
columnResizeDirection: this.columnResizeDirection(),
columnResizeMode: this.columnResizeMode(),
columns,
data: this.query.data() || [],
getCoreRowModel: getCoreRowModel(),
})),
)
}Last updated on by Ryan Bower