summaryrefslogtreecommitdiff
path: root/lib/docu-list-rule/combo-box-settings/table/combo-box-settings-table.tsx
diff options
context:
space:
mode:
author0-Zz-ang <s1998319@gmail.com>2025-08-07 18:02:54 +0900
committer0-Zz-ang <s1998319@gmail.com>2025-08-07 18:02:54 +0900
commit67bb1ad7d7e001e19c8d1dd9153a5f663e2afa03 (patch)
tree9aab25663d6c180fd3a315840a3035b491ac0b7d /lib/docu-list-rule/combo-box-settings/table/combo-box-settings-table.tsx
parente270e477f362dd68249bb4a013c66eab293bba82 (diff)
(박서영)docu-list-rule Project_code적용
Diffstat (limited to 'lib/docu-list-rule/combo-box-settings/table/combo-box-settings-table.tsx')
-rw-r--r--lib/docu-list-rule/combo-box-settings/table/combo-box-settings-table.tsx25
1 files changed, 22 insertions, 3 deletions
diff --git a/lib/docu-list-rule/combo-box-settings/table/combo-box-settings-table.tsx b/lib/docu-list-rule/combo-box-settings/table/combo-box-settings-table.tsx
index 42ce1a19..8e469149 100644
--- a/lib/docu-list-rule/combo-box-settings/table/combo-box-settings-table.tsx
+++ b/lib/docu-list-rule/combo-box-settings/table/combo-box-settings-table.tsx
@@ -5,8 +5,8 @@ import { useDataTable } from "@/hooks/use-data-table"
import { DataTable } from "@/components/data-table/data-table"
import { DataTableAdvancedToolbar } from "@/components/data-table/data-table-advanced-toolbar"
import type { DataTableAdvancedFilterField } from "@/types/table"
-import { getColumns } from "./combo-box-settings-table-columns"
-import { ComboBoxOptionsDetailSheet } from "./combo-box-options-detail-sheet"
+import { getColumns } from "@/lib/docu-list-rule/combo-box-settings/table/combo-box-settings-table-columns"
+import { ComboBoxOptionsDetailSheet } from "@/lib/docu-list-rule/combo-box-settings/table/combo-box-options-detail-sheet"
import { codeGroups } from "@/db/schema/docu-list-rule"
interface ComboBoxSettingsTableProps {
@@ -61,11 +61,30 @@ export function ComboBoxSettingsTable({ promises }: ComboBoxSettingsTableProps)
},
],
},
- getRowId: (originalRow) => String(originalRow.groupId),
+ getRowId: (originalRow) => String(originalRow.id),
shallow: false,
clearOnDefault: true,
})
+ // 컴포넌트 마운트 후 그룹핑 설정
+ React.useEffect(() => {
+ if (rawData[0]?.data && table.getState().grouping.length === 0) {
+ table.setGrouping(["projectCode"])
+ }
+ }, [table, rawData])
+
+ // 정렬 시 펼쳐진 상태 유지
+ React.useEffect(() => {
+ const currentExpanded = table.getState().expanded
+ if (Object.keys(currentExpanded).length > 0) {
+ // 약간의 지연 후 현재 펼쳐진 상태를 다시 설정
+ const timer = setTimeout(() => {
+ table.setExpanded(currentExpanded)
+ }, 100)
+ return () => clearTimeout(timer)
+ }
+ }, [table.getState().sorting, table])
+
return (
<>
<DataTable table={table}>