Sorting & Paging
Click a header to sort; Shift+click chains a multi-sort; a third click clears it. All 10,000 rows are processed client-side — the same interactions drive LoadOptions against a remote source.
sorting paging pageSizes
10.000 rows multi-sort stateKey
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgeColumn, OgeGrid } from '@oge-ui/grid';
@Component({
selector: 'demo-root',
imports: [OgeColumn, OgeGrid],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<oge-grid [data]="employees" keyField="id"
[paging]="{ pageSize: 15, pageSizes: [15, 25, 50] }"
[sorting]="{ mode: 'multi', allowUnsorting: true }">
<oge-column field="id" caption="Id" [width]="80" dataType="number" />
<oge-column field="firstName" caption="First Name" />
<oge-column field="lastName" caption="Last Name" />
<oge-column field="salary" caption="Salary" dataType="number" />
</oge-grid>
`,
})
export class Demo {
readonly employees = [
{ id: 1, firstName: 'Ali', lastName: 'Yılmaz', department: 'Engineering', city: 'İstanbul', salary: 8400, hireDate: '2019-03-11' },
{ id: 2, firstName: 'Ayşe', lastName: 'Kaya', department: 'Sales', city: 'Ankara', salary: 7200, hireDate: '2020-07-02' },
{ id: 3, firstName: 'Mehmet', lastName: 'Demir', department: 'Engineering', city: 'İzmir', salary: 9100, hireDate: '2018-01-23' },
{ id: 4, firstName: 'Zeynep', lastName: 'Şahin', department: 'Finance', city: 'İstanbul', salary: 6800, hireDate: '2021-11-15' },
{ id: 5, firstName: 'Emre', lastName: 'Çelik', department: 'Support', city: 'Bursa', salary: 5400, hireDate: '2022-05-09' },
];
}Notes
- Sorting is stable: rows with equal keys keep their relative order, so multi-sort chains behave predictably.
null/undefinedvalues always sort last in ascending order; string comparison is case-insensitive and numeric-aware ("item2" < "item10").- The sort indicator shows the chain position (¹, ²) when more than one column is sorted.
- Disable clearing with
[sorting]="{ allowUnsorting: false }", or globally viaprovideOgeGridConfig. - This demo has
stateKey="docs-sorting"— sort a column, reload the page, and the state comes back (localStorage by default, pluggable viaOGE_STATE_STORAGE). - Right-click any header for the built-in menu: sort, pin, hide.