| 27 | changeDetection: ChangeDetectionStrategy.OnPush, |
| 28 | }) |
| 29 | export 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 | } |
nothing calls this directly
no test coverage detected