From f09fc1172cd50c705b922cabbe667c5c20dcca3e Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Thu, 22 Jun 2023 15:02:43 +0900 Subject: [PATCH] =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=EB=B3=84=20datepick?= =?UTF-8?q?er=20=EC=B4=88=EA=B8=B0=ED=99=94=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WEB-INF/jsp/fims/crdn/crdn06010-main.jsp | 21 ++++++------------- .../WEB-INF/jsp/fims/crdn/crdn06030-main.jsp | 19 ++++------------- src/main/webapp/WEB-INF/jsp/include/tail.jsp | 2 +- .../js/fims/framework/cmm/initDatepicker.js | 17 +++++++++++++++ 4 files changed, 28 insertions(+), 31 deletions(-) create mode 100644 src/main/webapp/resources/js/fims/framework/cmm/initDatepicker.js diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06010-main.jsp index 21d073cf..280429dc 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06010-main.jsp @@ -298,26 +298,17 @@ $(document).ready(function(){ thisPO.tbodyTemplate = {}; - //페이지로딩 후 초기화 + //그리드 정보 초기화 thisPO.tbodyTemplate = initGrid(thisPO.gridOptions); - - $("#schDateFrom--${pageName}").datepicker({ - changeMonth: true, - changeYear: true, - showButtonPanel: true - }); - $("#schDateTo--${pageName}").datepicker({ - changeMonth: true, - changeYear: true, - showButtonPanel: true - }); + + //달력 초기화 + initDatepicker("frmSearch--${pageName}"); + $('#schDateFrom--${pageName}').datepicker('setDate', DateUtil.getDateDay(-5475).date); $('#schDateTo--${pageName}').datepicker('setDate', new Date()); - $( "#frmSearch--${pageName} .form-date" ).next("button.bx-calendar").on("click", function() { - $(this).prev().focus(); - }); + var defaultBizValue = $("#layout-navbar input[name='taskSeCd']:checked").val(); $("#frmSearch--${pageName} input[name='taskSeCd'][value='" + defaultBizValue + "']").prop("checked",true); thisPO.fnResetAndChangeBiz(defaultBizValue); diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06030-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06030-main.jsp index 0db1690f..ee93ab53 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06030-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06030-main.jsp @@ -273,26 +273,15 @@ $(document).ready(function(){ thisPO.tbodyTemplate = {}; - //페이지로딩 후 초기화 + //그리드 정보 초기화 thisPO.tbodyTemplate = initGrid(thisPO.gridOptions); + + //달력 초기화 + initDatepicker("frmSearch--${pageName}"); - $("#schDateFrom--${pageName}").datepicker({ - changeMonth: true, - changeYear: true, - showButtonPanel: true - }); - $("#schDateTo--${pageName}").datepicker({ - changeMonth: true, - changeYear: true, - showButtonPanel: true - }); $('#schDateFrom--${pageName}').datepicker('setDate', DateUtil.getDateDay(-5475).date); $('#schDateTo--${pageName}').datepicker('setDate', new Date()); - $( "#frmSearch--${pageName} .form-date" ).next("button.bx-calendar").on("click", function() { - $(this).prev().focus(); - }); - //스크롤 이벤트 추가 diff --git a/src/main/webapp/WEB-INF/jsp/include/tail.jsp b/src/main/webapp/WEB-INF/jsp/include/tail.jsp index 6f2c294e..1ee6b930 100644 --- a/src/main/webapp/WEB-INF/jsp/include/tail.jsp +++ b/src/main/webapp/WEB-INF/jsp/include/tail.jsp @@ -47,7 +47,7 @@ - + diff --git a/src/main/webapp/resources/js/fims/framework/cmm/initDatepicker.js b/src/main/webapp/resources/js/fims/framework/cmm/initDatepicker.js new file mode 100644 index 00000000..e2b550a4 --- /dev/null +++ b/src/main/webapp/resources/js/fims/framework/cmm/initDatepicker.js @@ -0,0 +1,17 @@ +function initDatepicker(elementId){ + + var executionArea = $("#"+elementId); + + /*--------------------- 달력 제어 ---------------------*/ + executionArea.find(".form-date").datepicker({ + changeMonth: true, + changeYear: true, + showButtonPanel: true + }); + + executionArea.find(".form-date").next("button.bx-calendar").on("click", function() { + $(this).prev().focus(); + }); + +} + \ No newline at end of file