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

Class AppComponent

examples/angular/editable/src/app/app.component.ts:87–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85 changeDetection: ChangeDetectionStrategy.OnPush,
86})
87export class AppComponent {
88 readonly data = signal<Person[]>(makeData(10_000))
89 readonly injector = inject(Injector)
90
91 readonly autoResetPageIndex = signal(true)
92
93 readonly table = createAngularTable(() => ({
94 data: this.data(),
95 columns: defaultColumns,
96 defaultColumn: defaultColumn,
97 getCoreRowModel: getCoreRowModel(),
98 getFilteredRowModel: getFilteredRowModel(),
99 getPaginationRowModel: getPaginationRowModel(),
100 debugTable: true,
101 autoResetPageIndex: this.autoResetPageIndex(),
102 // Provide our updateData function to our table meta
103 meta: {
104 updateData: (rowIndex, columnId, value) => {
105 // Skip page index reset until after next rerender
106 this.autoResetPageIndex.set(false)
107
108 this.data.update(old =>
109 old.map((row, index) => {
110 if (index === rowIndex) {
111 return {
112 ...old[rowIndex],
113 [columnId]: value,
114 }
115 }
116 return row
117 })
118 )
119
120 afterNextRender(() => this.autoResetPageIndex.set(true), {
121 injector: this.injector,
122 })
123 },
124 },
125 }))
126
127 refresh() {
128 this.data.set(makeData(10_000))
129 }
130}

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…