MCPcopy
hub / github.com/TanStack/table / AppComponent

Class AppComponent

examples/angular/column-ordering/src/app/app.component.ts:77–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75 changeDetection: ChangeDetectionStrategy.OnPush,
76})
77export class AppComponent {
78 readonly data = signal<Person[]>(makeData(20))
79 readonly columnVisibility = signal<VisibilityState>({})
80 readonly columnOrder = signal<ColumnOrderState>([])
81
82 readonly table = createAngularTable(() => ({
83 data: this.data(),
84 columns: defaultColumns,
85 state: {
86 columnOrder: this.columnOrder(),
87 columnVisibility: this.columnVisibility(),
88 },
89 getCoreRowModel: getCoreRowModel(),
90 onColumnVisibilityChange: updaterOrValue => {
91 typeof updaterOrValue === 'function'
92 ? this.columnVisibility.update(updaterOrValue)
93 : this.columnVisibility.set(updaterOrValue)
94 },
95 onColumnOrderChange: updaterOrValue => {
96 typeof updaterOrValue === 'function'
97 ? this.columnOrder.update(updaterOrValue)
98 : this.columnOrder.set(updaterOrValue)
99 },
100 debugTable: true,
101 debugHeaders: true,
102 debugColumns: true,
103 }))
104
105 readonly stringifiedColumnOrdering = computed(() => {
106 return JSON.stringify(this.table.getState().columnOrder)
107 })
108
109 randomizeColumns() {
110 this.table.setColumnOrder(
111 faker.helpers.shuffle(this.table.getAllLeafColumns().map(d => d.id))
112 )
113 }
114
115 rerender() {
116 this.data.set([...makeData(20)])
117 }
118}

Callers

nothing calls this directly

Calls 4

makeDataFunction · 0.90
createAngularTableFunction · 0.90
getCoreRowModelFunction · 0.85
updateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…