MCPcopy Index your code
hub / github.com/TanStack/table / AppComponent

Class AppComponent

examples/angular/grouping/src/app/app.component.ts:29–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27 changeDetection: ChangeDetectionStrategy.OnPush,
28})
29export class AppComponent {
30 title = 'grouping'
31 data = signal(makeData(10000))
32 grouping = signal<GroupingState>([])
33
34 stringifiedGrouping = computed(() => JSON.stringify(this.grouping(), null, 2))
35
36 tableOptions = computed(() => ({
37 data: this.data(),
38 columns: columns,
39 state: {
40 grouping: this.grouping(),
41 },
42 onGroupingChange: (updaterOrValue: Updater<GroupingState>) => {
43 const groupingState =
44 typeof updaterOrValue === 'function'
45 ? updaterOrValue([...this.grouping()])
46 : updaterOrValue
47 this.grouping.set(groupingState)
48 },
49 getExpandedRowModel: getExpandedRowModel(),
50 getGroupedRowModel: getGroupedRowModel(),
51 getCoreRowModel: getCoreRowModel(),
52 getPaginationRowModel: getPaginationRowModel(),
53 getFilteredRowModel: getFilteredRowModel(),
54 debugTable: true,
55 }))
56
57 table = createAngularTable(this.tableOptions)
58
59 onPageInputChange(event: any): void {
60 const page = event.target.value ? Number(event.target.value) - 1 : 0
61 this.table.setPageIndex(page)
62 }
63
64 onPageSizeChange(event: any) {
65 this.table.setPageSize(Number(event.target.value))
66 }
67
68 refreshData() {
69 this.data.set(makeData(10000))
70 }
71}

Callers

nothing calls this directly

Calls 7

makeDataFunction · 0.90
createAngularTableFunction · 0.90
getExpandedRowModelFunction · 0.85
getGroupedRowModelFunction · 0.85
getCoreRowModelFunction · 0.85
getPaginationRowModelFunction · 0.85
getFilteredRowModelFunction · 0.85

Tested by

no test coverage detected