diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-09-01 10:16:13 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-09-01 10:16:13 +0000 |
| commit | 20ba04d8588a7dfa6f65b1c080d6373631449f59 (patch) | |
| tree | 3d275643adfbdfd37627d768291d5fc0f40fd826 /components/data-table | |
| parent | 99ca52106b9a7beeb8d31aeb333b4084648007c7 (diff) | |
(정희성) 테이블 sort, group 그룹핑 컬럼 호출 시 오류 수정
Diffstat (limited to 'components/data-table')
| -rw-r--r-- | components/data-table/data-table-group-list.tsx | 6 | ||||
| -rw-r--r-- | components/data-table/data-table-sort-list.tsx | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/components/data-table/data-table-group-list.tsx b/components/data-table/data-table-group-list.tsx index 213b429f..c00fac42 100644 --- a/components/data-table/data-table-group-list.tsx +++ b/components/data-table/data-table-group-list.tsx @@ -85,6 +85,12 @@ export function DataTableGroupList<TData>({ () => table .getAllColumns() + .flatMap((column) => { + if (column.columns && column.columns.length > 0) { + return column.columns.filter(c => c.getCanSort()); + } + return column.getCanSort() ? [column] : []; + }) .filter((col) => col.getCanGroup?.() !== false) .map((col) => ({ id: col.id, diff --git a/components/data-table/data-table-sort-list.tsx b/components/data-table/data-table-sort-list.tsx index 21926f34..85484b09 100644 --- a/components/data-table/data-table-sort-list.tsx +++ b/components/data-table/data-table-sort-list.tsx @@ -108,6 +108,13 @@ export function DataTableSortList<TData>({ () => table .getAllColumns() + .flatMap((column) => { + // 그룹 컬럼이면 leaf 컬럼만 추출 + if (column.columns && column.columns.length > 0) { + return column.columns.filter(c => c.getCanSort()); + } + return column.getCanSort() ? [column] : []; + }) .filter( (column) => column.getCanSort() && !sorting.some((s) => s.id === column.id) |
