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

Class AppComponent

examples/angular/column-pinning/src/app/app.component.ts:88–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86 changeDetection: ChangeDetectionStrategy.OnPush,
87})
88export class AppComponent {
89 readonly data = signal<Person[]>(makeData(5000))
90 readonly columnVisibility = signal<VisibilityState>({})
91 readonly columnOrder = signal<ColumnOrderState>([])
92 readonly columnPinning = signal<ColumnPinningState>({})
93 readonly split = signal(false)
94
95 table = createAngularTable(() => ({
96 data: this.data(),
97 columns: defaultColumns,
98 state: {
99 columnVisibility: this.columnVisibility(),
100 columnOrder: this.columnOrder(),
101 columnPinning: this.columnPinning(),
102 },
103 onColumnVisibilityChange: updaterOrValue => {
104 typeof updaterOrValue === 'function'
105 ? this.columnVisibility.update(updaterOrValue)
106 : this.columnVisibility.set(updaterOrValue)
107 },
108 onColumnOrderChange: updaterOrValue => {
109 typeof updaterOrValue === 'function'
110 ? this.columnOrder.update(updaterOrValue)
111 : this.columnOrder.set(updaterOrValue)
112 },
113 onColumnPinningChange: updaterOrValue => {
114 typeof updaterOrValue === 'function'
115 ? this.columnPinning.update(updaterOrValue)
116 : this.columnPinning.set(updaterOrValue)
117 },
118 getCoreRowModel: getCoreRowModel(),
119 debugTable: true,
120 debugHeaders: true,
121 debugColumns: true,
122 }))
123
124 stringifiedColumnPinning = computed(() => {
125 return JSON.stringify(this.table.getState().columnPinning)
126 })
127
128 randomizeColumns() {
129 this.table.setColumnOrder(
130 faker.helpers.shuffle(this.table.getAllLeafColumns().map(d => d.id))
131 )
132 }
133
134 rerender() {
135 this.data.set(makeData(5000))
136 }
137}

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…