diff --git a/frontend/lib/registry/components/split-panel-layout/SplitPanelLayoutComponent.tsx b/frontend/lib/registry/components/split-panel-layout/SplitPanelLayoutComponent.tsx index e674e1a9..c3991ae3 100644 --- a/frontend/lib/registry/components/split-panel-layout/SplitPanelLayoutComponent.tsx +++ b/frontend/lib/registry/components/split-panel-layout/SplitPanelLayoutComponent.tsx @@ -1451,27 +1451,8 @@ export const SplitPanelLayoutComponent: React.FC // 커스텀 모달 화면 열기 const rightTableName = componentConfig.rightPanel?.tableName || ""; - // Primary Key 찾기 (우선순위: id > ID > 첫 번째 필드) - let primaryKeyName = "id"; - let primaryKeyValue: any; - - if (item.id !== undefined && item.id !== null) { - primaryKeyName = "id"; - primaryKeyValue = item.id; - } else if (item.ID !== undefined && item.ID !== null) { - primaryKeyName = "ID"; - primaryKeyValue = item.ID; - } else { - // 첫 번째 필드를 Primary Key로 간주 - const firstKey = Object.keys(item)[0]; - primaryKeyName = firstKey; - primaryKeyValue = item[firstKey]; - } - console.log("✅ 수정 모달 열기:", { tableName: rightTableName, - primaryKeyName, - primaryKeyValue, screenId: modalScreenId, fullItem: item, }); @@ -1490,27 +1471,25 @@ export const SplitPanelLayoutComponent: React.FC hasGroupByColumns: groupByColumns.length > 0, }); - // ScreenModal 열기 이벤트 발생 (URL 파라미터로 ID + groupByColumns 전달) + // 🔧 수정: URL 파라미터 대신 editData로 직접 전달 + // 이렇게 하면 테이블의 Primary Key가 무엇이든 상관없이 데이터가 정확히 전달됨 window.dispatchEvent( new CustomEvent("openScreenModal", { detail: { screenId: modalScreenId, - urlParams: { - mode: "edit", - editId: primaryKeyValue, - tableName: rightTableName, - ...(groupByColumns.length > 0 && { + editData: item, // 전체 데이터를 직접 전달 + ...(groupByColumns.length > 0 && { + urlParams: { groupByColumns: JSON.stringify(groupByColumns), - }), - }, + }, + }), }, }), ); - console.log("✅ [SplitPanel] openScreenModal 이벤트 발생:", { + console.log("✅ [SplitPanel] openScreenModal 이벤트 발생 (editData 직접 전달):", { screenId: modalScreenId, - editId: primaryKeyValue, - tableName: rightTableName, + editData: item, groupByColumns: groupByColumns.length > 0 ? JSON.stringify(groupByColumns) : "없음", });