From acd76ee2d21653918db57d76f8b28aa590ce6c00 Mon Sep 17 00:00:00 2001 From: hjjeong Date: Thu, 5 Mar 2026 16:57:19 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B7=B8=EB=A6=AC=EB=93=9C=20=EC=85=80=20?= =?UTF-8?q?=ED=81=B4=EB=A6=AD=20=EC=98=A4=EB=A5=98=20=EB=93=B1=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../quality/processInspectionFormPopUp.jsp | 43 ++++++++++++------- .../semiProductInspectionFormPopUp.jsp | 26 ++++++++--- 2 files changed, 49 insertions(+), 20 deletions(-) diff --git a/WebContent/WEB-INF/view/quality/processInspectionFormPopUp.jsp b/WebContent/WEB-INF/view/quality/processInspectionFormPopUp.jsp index ef0866e..129c0d1 100644 --- a/WebContent/WEB-INF/view/quality/processInspectionFormPopUp.jsp +++ b/WebContent/WEB-INF/view/quality/processInspectionFormPopUp.jsp @@ -181,6 +181,8 @@ function fn_select2Editor(cell, onRendered, success, cancel, editorParams) { var select = document.createElement("select"); select.style.width = "100%"; + select.style.opacity = "0"; + select.style.position = "absolute"; // 옵션 생성 if(values && values.length > 0) { @@ -203,21 +205,32 @@ function fn_select2Editor(cell, onRendered, success, cancel, editorParams) { width: "100%" }); $(select).select2("open"); - - $(select).on("select2:select select2:clear", function(e) { - var selectedVal = $(select).val() || ""; - - // 콜백 호출 (프로젝트 변경 시 연동 처리 등) - if(typeof editorParams.onSelect === "function") { - editorParams.onSelect(cell, selectedVal); - } - - success(selectedVal); - }); - - $(select).on("select2:close", function() { - setTimeout(function() { success($(select).val() || ""); }, 100); - }); + }); + + var isCleared = false; + + $(select).on("select2:select", function(e) { + var selectedVal = $(select).val() || ""; + if(typeof editorParams.onSelect === "function") { + editorParams.onSelect(cell, selectedVal); + } + success(selectedVal); + }); + + $(select).on("select2:clear", function(e) { + isCleared = true; + if(typeof editorParams.onSelect === "function") { + editorParams.onSelect(cell, ""); + } + setTimeout(function() { + $(select).select2("close"); + success(""); + }, 0); + }); + + $(select).on("select2:close", function() { + if(isCleared) return; + success($(select).val() || ""); }); return container; diff --git a/WebContent/WEB-INF/view/quality/semiProductInspectionFormPopUp.jsp b/WebContent/WEB-INF/view/quality/semiProductInspectionFormPopUp.jsp index e881b7d..1ac39de 100644 --- a/WebContent/WEB-INF/view/quality/semiProductInspectionFormPopUp.jsp +++ b/WebContent/WEB-INF/view/quality/semiProductInspectionFormPopUp.jsp @@ -386,6 +386,8 @@ function createSelect2Editor(options, allowClear) { var container = document.createElement("span"); var select = document.createElement("select"); select.style.width = "100%"; + select.style.opacity = "0"; + select.style.position = "absolute"; var emptyOption = document.createElement("option"); emptyOption.value = ""; @@ -410,14 +412,28 @@ function createSelect2Editor(options, allowClear) { allowClear: allowClear !== false, dropdownParent: $('body') }); - - $(select).on('select2:select select2:clear', function(e) { - success($(select).val() || ''); - }); - $(select).select2('open'); }); + var isCleared = false; + + $(select).on('select2:select', function(e) { + success($(select).val() || ''); + }); + + $(select).on('select2:clear', function(e) { + isCleared = true; + setTimeout(function() { + $(select).select2('close'); + success(''); + }, 0); + }); + + $(select).on('select2:close', function() { + if(isCleared) return; + success($(select).val() || ''); + }); + return container; }; }