From 4614210aa9878922cfa1e424ce677ef893a1b6b2 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Mon, 29 Sep 2025 13:31:40 +0000
Subject: (대표님) 구매 권한설정, data room 등
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 components/form-data/spreadJS-dialog.tsx | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

(limited to 'components/form-data/spreadJS-dialog.tsx')

diff --git a/components/form-data/spreadJS-dialog.tsx b/components/form-data/spreadJS-dialog.tsx
index 19c9a616..d001463e 100644
--- a/components/form-data/spreadJS-dialog.tsx
+++ b/components/form-data/spreadJS-dialog.tsx
@@ -1055,8 +1055,18 @@ const createGrdListTableOptimized = React.useCallback((activeSheet: any, templat
 
           if (templateType === 'SPREAD_LIST' && tableData.length > 0) {
             updateProgress('Processing data rows...', 60, 100);
-            
-            dataSheets.forEach(dataSheet => {
+
+            const activeSheetName = workingTemplate.SPR_LST_SETUP?.ACT_SHEET;
+
+            const matchingDataSheets = dataSheets.filter(ds => 
+              ds.SHEET_NAME === activeSheetName
+            );
+
+            if (activeSheetName && spread.getSheetFromName(activeSheetName)) {
+              spread.setActiveSheet(activeSheetName);
+            }
+
+            matchingDataSheets.forEach(dataSheet => {
               if (dataSheet.MAP_CELL_ATT && dataSheet.MAP_CELL_ATT.length > 0) {
                 dataSheet.MAP_CELL_ATT.forEach((mapping: any) => {
                   const { ATT_ID, IN } = mapping;
@@ -1115,8 +1125,17 @@ const createGrdListTableOptimized = React.useCallback((activeSheet: any, templat
             
           } else if (templateType === 'SPREAD_ITEM' && selectedRow) {
             updateProgress('Setting up form fields...', 60, 100);
-            
-            dataSheets.forEach(dataSheet => {
+              const activeSheetName = workingTemplate.SPR_ITM_LST_SETUP?.ACT_SHEET;
+
+              const matchingDataSheets = dataSheets.filter(ds => 
+                ds.SHEET_NAME === activeSheetName
+              );
+  
+              if (activeSheetName && spread.getSheetFromName(activeSheetName)) {
+                spread.setActiveSheet(activeSheetName);
+              }
+
+              matchingDataSheets.forEach(dataSheet => {
               dataSheet.MAP_CELL_ATT?.forEach((mapping: any) => {
                 const { ATT_ID, IN } = mapping;
                 const cellPos = parseCellAddress(IN);
-- 
cgit v1.2.3

