From 20ba04d8588a7dfa6f65b1c080d6373631449f59 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 1 Sep 2025 10:16:13 +0000 Subject: (정희성) 테이블 sort, group 그룹핑 컬럼 호출 시 오류 수정 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/client-data-table/data-table-group-list.tsx | 6 ++++++ components/client-data-table/data-table-sort-list.tsx | 6 ++++++ 2 files changed, 12 insertions(+) (limited to 'components/client-data-table') diff --git a/components/client-data-table/data-table-group-list.tsx b/components/client-data-table/data-table-group-list.tsx index 519b7327..6fe738e2 100644 --- a/components/client-data-table/data-table-group-list.tsx +++ b/components/client-data-table/data-table-group-list.tsx @@ -55,6 +55,12 @@ export function ClientDataTableGroupList({ () => table .getAllColumns() + .flatMap((column) => { + if (column.columns && column.columns.length > 0) { + return column.columns.filter(c => c.getCanGroup()); + } + return column.getCanGroup() ? [column] : []; + }) .filter((col) => col.getCanGroup?.() !== false) .map((col) => { // If meta?.excelHeader is missing or undefined, fall back to `col.id` diff --git a/components/client-data-table/data-table-sort-list.tsx b/components/client-data-table/data-table-sort-list.tsx index b67fdde3..475a2798 100644 --- a/components/client-data-table/data-table-sort-list.tsx +++ b/components/client-data-table/data-table-sort-list.tsx @@ -64,6 +64,12 @@ export function ClientDataTableSortList({ table }: DataTableSortListLocal const sortableColumns = React.useMemo(() => { return 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.getCanSort()) .map((col) => ({ id: col.id, -- cgit v1.2.3