From 62c4fa001360c1339e50fc0588d73a7d98d8232a Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Wed, 6 Dec 2023 17:12:36 +0900 Subject: [PATCH] =?UTF-8?q?=EC=8A=A4=ED=81=AC=EB=A1=A4=EB=A7=81=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=20=EB=B0=A9=EC=8B=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WEB-INF/jsp/fims/crdn/crdn02010-main.jsp | 47 +++++------------ .../WEB-INF/jsp/fims/crdn/crdn03010-main.jsp | 31 +++-------- .../WEB-INF/jsp/fims/crdn/crdn05010-main.jsp | 32 +++--------- .../WEB-INF/jsp/fims/crdn/crdn06010-main.jsp | 33 +++--------- .../WEB-INF/jsp/fims/crdn/crdn08010-main.jsp | 32 +++--------- .../WEB-INF/jsp/fims/cvlc/cvlc01010-main.jsp | 31 +++-------- .../WEB-INF/jsp/fims/cvlc/cvlc02010-main.jsp | 34 +++--------- .../WEB-INF/jsp/fims/cvlc/cvlc03010-main.jsp | 32 +++--------- .../WEB-INF/jsp/fims/cvlc/cvlc04010-main.jsp | 31 +++-------- .../WEB-INF/jsp/fims/levy/levy02010-main.jsp | 32 +++--------- .../js/fims/framework/cmm/componentization.js | 52 +++++++++++++++++++ 11 files changed, 128 insertions(+), 259 deletions(-) diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn02010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn02010-main.jsp index 33941598..f40ba449 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn02010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn02010-main.jsp @@ -650,23 +650,6 @@ $(document).ready(function(){ $P.sameVehicleControl.sub.load(0); } - $P.scrollEnd = (obj) => { - if(obj.dataset.scrollStatus){ - return; - } - - var el = $(obj); - if(el.scrollTop() == 0){ - return; - } - - if((el[0].scrollHeight - el.scrollTop() + VERTICAL_SCROLL_HEIGHT) <= el.outerHeight()){ - obj.dataset.scrollStatus = "waiting"; - $P.scrollInspectionDataList(); - } - - } - $P.scrollInspectionDataList = () => { switch ($P.currentDisplay) { case "photoInspection": @@ -885,14 +868,12 @@ $(document).ready(function(){ var replacer = (str, dataItem) => str .replace(/{onclick}/gi, "pageObject['${pageName}'].clickInspectionDataList('" + dataItem.getValue("CRDN_ID") + "','photoInspection');") .replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickInspectionDataList('" + dataItem.getValue("CRDN_ID") + "','photoInspection');"); + var trs = empty ? notFound : dataList.inStrings(found, replacer); - $("#photoInspectionTbody--${pageName}").html(trs.join()); - - if(total == dataList.length){ - $("#photoInspection-responsive--${pageName}").attr("data-scroll-status", "complete"); - } else { - $("#photoInspection-responsive--${pageName}").removeAttr("data-scroll-status"); - } + var noMore = (total == dataList.length); + var initScroll = ($P.photoInspectionControl.query.pageNum < 2) && ($P.photoInspectionControl.untilPageNum == 0); + + $("#photoInspection-responsive--${pageName}")[0].changeContent(trs.join(), initScroll, noMore); if($P.photoInspectionControl.untilPageNum != 0){ $P.photoInspectionControl.query.fetchSize = $P.photoInspectionControl.defaultFetchSize; @@ -907,14 +888,13 @@ $(document).ready(function(){ var found = document.getElementById("sameVehicleInspectionMainRow--${pageName}").innerHTML; var replacer = (str, dataItem) => str .replace(/{onclick}/gi, "pageObject['${pageName}'].clickInspectionDataList('" + dataItem.getValue("CRDN_ID_LIST") + "','sameVehicleInspectionMain');"); + var trs = empty ? notFound : dataList.inStrings(found, replacer); - $("#sameVehicleInspectionMainTbody--${pageName}").html(trs.join()); + var noMore = (total == dataList.length); + var initScroll = ($P.sameVehicleControl.main.query.pageNum < 2) && ($P.sameVehicleControl.untilPageNum == 0); + + $("#sameVehicleInspectionMain-responsive--${pageName}")[0].changeContent(trs.join(), initScroll, noMore); - if(total == dataList.length){ - $("#sameVehicleInspectionMain-responsive--${pageName}").attr("data-scroll-status", "complete"); - } else { - $("#sameVehicleInspectionMain-responsive--${pageName}").removeAttr("data-scroll-status"); - } if($P.sameVehicleControl.untilPageNum != 0){ $P.sameVehicleControl.main.query.fetchSize = $P.sameVehicleControl.defaultFetchSize; @@ -979,9 +959,10 @@ $(document).ready(function(){ $("#btnInstLevyExcl--${pageName}").on("click", () => $P.openLevyExclPop("1")); - //스크롤 이벤트 추가(동일차량검사) - $("#photoInspection-responsive--${pageName}").on("scrollend", function(){ $P.scrollEnd(this); }); - $("#sameVehicleInspectionMain-responsive--${pageName}").on("scrollend", function(){ $P.scrollEnd(this); }); + //스크롤 테이블 + fnMakeScrollableTable($("#photoInspection-responsive--${pageName}")[0], $P.scrollInspectionDataList); + fnMakeScrollableTable($("#sameVehicleInspectionMain-responsive--${pageName}")[0], $P.scrollInspectionDataList); + $("#photoInspection_Table_0--${pageName}").find("th").resizable({handles : "e"}); $("#sameVehicleInspectionMain_Table_0--${pageName}").find("th").resizable({handles : "e"}); $("#sameVehicleInspectionSub_Table_0--${pageName}").find("th").resizable({handles : "e"}); diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn03010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn03010-main.jsp index 96b37967..a9beb2ed 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn03010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn03010-main.jsp @@ -205,23 +205,6 @@ $(document).ready(function(){ $P.crdnControl.load(1); } - $P.scrollEnd = (obj) => { - if(obj.dataset.scrollStatus){ - return; - } - - var el = $(obj); - if(el.scrollTop() == 0){ - return; - } - - if((el[0].scrollHeight - el.scrollTop() + VERTICAL_SCROLL_HEIGHT) <= el.outerHeight()){ - obj.dataset.scrollStatus = "waiting"; - $P.scrollCrdnList(); - } - - } - $P.scrollCrdnList = () => { $P.crdnControl.load($P.crdnControl.query.pageNum + 1); } @@ -271,16 +254,14 @@ $(document).ready(function(){ .replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickCrdnList('" + dataItem.getValue("CRDN_ID") + "');"); var trs = empty ? notFound : crdnList.inStrings(found,replacer); - $("#crdnTbody--${pageName}").html(trs.join()); + var noMore = (total == crdnList.length); + var initScroll = ($P.crdnControl.query.pageNum < 2) && ($P.crdnControl.untilPageNum == 0); + + $("#table-responsive--${pageName}")[0].changeContent(trs.join(), initScroll, noMore); //보안모드 fn_securityModeToggle($("#securityMode--top").is(":checked")); - if(total == crdnList.length){ - $("#table-responsive--${pageName}").attr("data-scroll-status", "complete"); - } else { - $("#table-responsive--${pageName}").removeAttr("data-scroll-status"); - } if($P.crdnControl.untilPageNum != 0){ $P.crdnControl.query.fetchSize = $P.crdnControl.defaultFetchSize; @@ -317,7 +298,9 @@ $(document).ready(function(){ **************************************************************************/ $('#btnReset--${pageName}').on('click', () => $P.fnReset()); $('#btnSearch--${pageName}').on('click', () => $P.searchCrdnList()); - $("#table-responsive--${pageName}").on("scrollend", function(){ $P.scrollEnd(this); }); + + fnMakeScrollableTable($("#table-responsive--${pageName}")[0], $P.scrollCrdnList); + $('#btnUpdateToConfirmData--${pageName}').on('click', () => { if(!$P.crdnControl.getCurrent()) { diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn05010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn05010-main.jsp index 7309ff0b..09c3f1c1 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn05010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn05010-main.jsp @@ -243,23 +243,6 @@ $(document).ready(function(){ $P.crdnControl.load(1); } - $P.scrollEnd = (obj) => { - if(obj.dataset.scrollStatus){ - return; - } - - var el = $(obj); - if(el.scrollTop() == 0){ - return; - } - - if((el[0].scrollHeight - el.scrollTop() + VERTICAL_SCROLL_HEIGHT) <= el.outerHeight()){ - obj.dataset.scrollStatus = "waiting"; - $P.scrollCrdnList(); - } - - } - $P.scrollCrdnList = () => { $P.crdnControl.load($P.crdnControl.query.pageNum + 1); } @@ -286,17 +269,13 @@ $(document).ready(function(){ .replace(/{ondblclick}/gi, ""); var trs = empty ? notFound : crdnList.inStrings(found,replacer); - - $("#crdnTbody--${pageName}").html(trs.join()); + var noMore = (total == crdnList.length); + var initScroll = ($P.crdnControl.query.pageNum < 2) && ($P.crdnControl.untilPageNum == 0); + + $("#table-responsive--${pageName}")[0].changeContent(trs.join(), initScroll, noMore); //보안모드 fn_securityModeToggle($("#securityMode--top").is(":checked")); - - if(total == crdnList.length){ - $("#table-responsive--${pageName}").attr("data-scroll-status", "complete"); - } else { - $("#table-responsive--${pageName}").removeAttr("data-scroll-status"); - } if($P.crdnControl.untilPageNum != 0){ $P.crdnControl.query.fetchSize = $P.crdnControl.defaultFetchSize; @@ -320,7 +299,8 @@ $(document).ready(function(){ $("#btnInsertByFile--${pageName}").on('click', () => { $P.crdnControl.newInfo("file"); }); $("#btnInsertByHand--${pageName}").on('click', () => { $P.crdnControl.newInfo("hand"); }); - $("#table-responsive--${pageName}").on("scrollend", function(){ $P.scrollEnd(this); }); + fnMakeScrollableTable($("#table-responsive--${pageName}")[0], $P.scrollCrdnList); + $("#DataTables_Table_0--${pageName}").find("th").resizable({handles : "e"}); /************************************************************************** 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 2d7980f3..24efd0c9 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 @@ -383,23 +383,6 @@ $(document).ready(function(){ $P.crdnControl.load(1); } - $P.scrollEnd = (obj) => { - if(obj.dataset.scrollStatus){ - return; - } - - var el = $(obj); - if(el.scrollTop() == 0){ - return; - } - - if((el[0].scrollHeight - el.scrollTop() + VERTICAL_SCROLL_HEIGHT) <= el.outerHeight()){ - obj.dataset.scrollStatus = "waiting"; - $P.scrollCrdnList(); - } - - } - $P.scrollCrdnList = () => { $P.crdnControl.load($P.crdnControl.query.pageNum + 1); } @@ -457,17 +440,15 @@ $(document).ready(function(){ var replacer = (str, dataItem) => str .replace(/{onclick}/gi, "pageObject['${pageName}'].clickCrdnList('" + dataItem.getValue("CRDN_ID") + "');") .replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickCrdnList('" + dataItem.getValue("CRDN_ID") + "');"); + var trs = empty ? notFound : crdnList.inStrings(found, replacer); - $("#crdnTbody--${pageName}").html(trs.join()); + var noMore = (total == crdnList.length); + var initScroll = ($P.crdnControl.query.pageNum < 2) && ($P.crdnControl.untilPageNum == 0); + + $("#table-responsive--${pageName}")[0].changeContent(trs.join(), initScroll, noMore); fn_securityModeToggle($("#securityMode--top").is(":checked")); //보안모드 - if(total == crdnList.length){ - $("#table-responsive--${pageName}").attr("data-scroll-status", "complete"); - } else { - $("#table-responsive--${pageName}").removeAttr("data-scroll-status"); - } - if($P.crdnControl.untilPageNum != 0){ $P.crdnControl.query.fetchSize = $P.crdnControl.defaultFetchSize; $P.crdnControl.query.pageNum = $P.crdnControl.untilPageNum; @@ -488,8 +469,8 @@ $(document).ready(function(){ **************************************************************************/ $('#btnReset--${pageName}').on('click', () => $P.fnReset()); $('#btnSearch--${pageName}').on('click', () => $P.searchCrdnList()); - - $("#table-responsive--${pageName}").on("scrollend", function(){ $P.scrollEnd(this); }); + + fnMakeScrollableTable($("#table-responsive--${pageName}")[0], $P.scrollCrdnList); /************************************************************************** * 초기화 diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn08010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn08010-main.jsp index 240ce51d..53f83084 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn08010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn08010-main.jsp @@ -300,23 +300,6 @@ $(document).ready(function(){ $P.exmptnVhclControl.load(1); } - $P.scrollEnd = (obj) => { - if(obj.dataset.scrollStatus){ - return; - } - - var el = $(obj); - if(el.scrollTop() == 0){ - return; - } - - if((el[0].scrollHeight - el.scrollTop() + VERTICAL_SCROLL_HEIGHT) <= el.outerHeight()){ - obj.dataset.scrollStatus = "waiting"; - $P.scrollExmptnVhclList(); - } - - } - $P.scrollExmptnVhclList = () => { $P.exmptnVhclControl.load($P.exmptnVhclControl.query.pageNum + 1); } @@ -365,17 +348,13 @@ $(document).ready(function(){ .replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickExmptnVhclList('" + dataItem.getValue("EXMPTN_VHCL_ID") + "');"); var trs = empty ? notFound : exmptnVhclList.inStrings(found,replacer); - - $("#exmptnVhclTbody--${pageName}").html(trs.join()); + var noMore = (total == exmptnVhclList.length); + var initScroll = ($P.exmptnVhclControl.query.pageNum < 2) && ($P.exmptnVhclControl.untilPageNum == 0); + + $("#table-responsive--${pageName}")[0].changeContent(trs.join(), initScroll, noMore); //보안모드 fn_securityModeToggle($("#securityMode--top").is(":checked")); - - if(total == exmptnVhclList.length){ - $("#table-responsive--${pageName}").attr("data-scroll-status", "complete"); - } else { - $("#table-responsive--${pageName}").removeAttr("data-scroll-status"); - } if($P.exmptnVhclControl.untilPageNum != 0){ $P.exmptnVhclControl.query.fetchSize = $P.exmptnVhclControl.defaultFetchSize; @@ -461,7 +440,8 @@ $(document).ready(function(){ $("#btnOpenDelRsn--${pageName}").on('click', () => { $P.fnOpenDelRsnDialog(); }); $("#btnHistory--${pageName}").on('click', () => { $P.fnOpenHistory(); }); - $("#table-responsive--${pageName}").on("scrollend", function(){ $P.scrollEnd(this); }); + fnMakeScrollableTable($("#table-responsive--${pageName}")[0], $P.scrollExmptnVhclList); + $("#DataTables_Table_0--${pageName}").find("th").resizable({handles : "e"}); /************************************************************************** diff --git a/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc01010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc01010-main.jsp index 111db058..0b080f24 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc01010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc01010-main.jsp @@ -361,23 +361,6 @@ $(document).ready(function(){ $P.crdnControl.load(1); } - $P.scrollEnd = (obj) => { - if(obj.dataset.scrollStatus){ - return; - } - - var el = $(obj); - if(el.scrollTop() == 0){ - return; - } - - if((el[0].scrollHeight - el.scrollTop() + VERTICAL_SCROLL_HEIGHT) <= el.outerHeight()){ - obj.dataset.scrollStatus = "waiting"; - $P.scrollCrdnList(); - } - - } - $P.scrollCrdnList = () => { $P.crdnControl.load($P.crdnControl.query.pageNum + 1); } @@ -463,17 +446,16 @@ $(document).ready(function(){ var replacer = (str, dataItem) => str .replace(/{onclick}/gi, "pageObject['${pageName}'].clickCrdnList('" + dataItem.getValue("CRDN_ID") + "');") .replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickCrdnList('" + dataItem.getValue("CRDN_ID") + "');"); + var trs = empty ? notFound : crdnList.inStrings(found, replacer); - $("#crdnTbody--${pageName}").html(trs.join()); + var noMore = (total == crdnList.length); + var initScroll = ($P.crdnControl.query.pageNum < 2) && ($P.crdnControl.untilPageNum == 0); + + $("#table-responsive--${pageName}")[0].changeContent(trs.join(), initScroll, noMore); //보안모드 fn_securityModeToggle($("#securityMode--top").is(":checked")); - if(total == crdnList.length){ - $("#table-responsive--${pageName}").attr("data-scroll-status", "complete"); - } else { - $("#table-responsive--${pageName}").removeAttr("data-scroll-status"); - } if($P.crdnControl.untilPageNum != 0){ $P.crdnControl.query.fetchSize = $P.crdnControl.defaultFetchSize; @@ -644,7 +626,8 @@ $(document).ready(function(){ $("#btnDeleteSameRcptYmd--${pageName}").on("click", () => $P.fnRemoveSameRcptYmd()); $("#btnOpenCvlcptOrgnl--${pageName}").on("click", () => $P.fnOpenCvlcptOrgnl()); - $("#table-responsive--${pageName}").on("scrollend", function(){ $P.scrollEnd(this); }); + fnMakeScrollableTable($("#table-responsive--${pageName}")[0], $P.scrollCrdnList); + $("#DataTables_Table_0--${pageName}").find("th").resizable({handles : "e"}); /************************************************************************** diff --git a/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc02010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc02010-main.jsp index 34b12b3f..a9e5c3b4 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc02010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc02010-main.jsp @@ -387,23 +387,6 @@ $(document).ready(function(){ $P.crdnControl.load(1); } - $P.scrollEnd = (obj) => { - if(obj.dataset.scrollStatus){ - return; - } - - var el = $(obj); - if(el.scrollTop() == 0){ - return; - } - - if((el[0].scrollHeight - el.scrollTop() + VERTICAL_SCROLL_HEIGHT) <= el.outerHeight()){ - obj.dataset.scrollStatus = "waiting"; - $P.scrollCrdnList(); - } - - } - $P.scrollCrdnList = () => { $P.crdnControl.load($P.crdnControl.query.pageNum + 1); } @@ -450,18 +433,16 @@ $(document).ready(function(){ var replacer = (str, dataItem) => str .replace(/{onclick}/gi, "pageObject['${pageName}'].clickCrdnList('" + dataItem.getValue("CRDN_ID") + "');") .replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickCrdnList('" + dataItem.getValue("CRDN_ID") + "');"); - var trs = empty ? notFound : crdnList.inStrings(found, replacer); - $("#crdnTbody--${pageName}").html(trs.join()); + + var trs = empty ? notFound : crdnList.inStrings(found, replacer); + var noMore = (total == crdnList.length); + var initScroll = ($P.crdnControl.query.pageNum < 2) && ($P.crdnControl.untilPageNum == 0); + + $("#table-responsive--${pageName}")[0].changeContent(trs.join(), initScroll, noMore); //보안모드 fn_securityModeToggle($("#securityMode--top").is(":checked")); - if(total == crdnList.length){ - $("#table-responsive--${pageName}").attr("data-scroll-status", "complete"); - } else { - $("#table-responsive--${pageName}").removeAttr("data-scroll-status"); - } - if($P.crdnControl.untilPageNum != 0){ $P.crdnControl.query.fetchSize = $P.crdnControl.defaultFetchSize; $P.crdnControl.query.pageNum = $P.crdnControl.untilPageNum; @@ -673,7 +654,8 @@ $(document).ready(function(){ $("#btnExecuteAnswer--${pageName}").on("click", () => $P.fnExecuteAnswer()); $("#btnAnswerComplete--${pageName}").on("click", () => $P.fnAnswerComplete()); - $("#table-responsive--${pageName}").on("scrollend", function(){ $P.scrollEnd(this); }); + fnMakeScrollableTable($("#table-responsive--${pageName}")[0], $P.scrollCrdnList); + $("#DataTables_Table_0--${pageName}").find("th").resizable({handles : "e"}); /************************************************************************** diff --git a/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc03010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc03010-main.jsp index 216c0f2c..2b9b55ee 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc03010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc03010-main.jsp @@ -348,23 +348,6 @@ $(document).ready(function(){ $P.crdnControl.load(1); } - $P.scrollEnd = (obj) => { - if(obj.dataset.scrollStatus){ - return; - } - - var el = $(obj); - if(el.scrollTop() == 0){ - return; - } - - if((el[0].scrollHeight - el.scrollTop() + VERTICAL_SCROLL_HEIGHT) <= el.outerHeight()){ - obj.dataset.scrollStatus = "waiting"; - $P.scrollCrdnList(); - } - - } - $P.scrollCrdnList = () => { $P.crdnControl.load($P.crdnControl.query.pageNum + 1); } @@ -417,18 +400,16 @@ $(document).ready(function(){ var replacer = (str, dataItem) => str .replace(/{onclick}/gi, "pageObject['${pageName}'].clickCrdnList('" + dataItem.getValue("CRDN_ID") + "');") .replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickCrdnList('" + dataItem.getValue("CRDN_ID") + "');"); + var trs = empty ? notFound : crdnList.inStrings(found, replacer); - $("#crdnTbody--${pageName}").html(trs.join()); + var noMore = (total == crdnList.length); + var initScroll = ($P.crdnControl.query.pageNum < 2) && ($P.crdnControl.untilPageNum == 0); + + $("#table-responsive--${pageName}")[0].changeContent(trs.join(), initScroll, noMore); //보안모드 fn_securityModeToggle($("#securityMode--top").is(":checked")); - if(total == crdnList.length){ - $("#table-responsive--${pageName}").attr("data-scroll-status", "complete"); - } else { - $("#table-responsive--${pageName}").removeAttr("data-scroll-status"); - } - if($P.crdnControl.untilPageNum != 0){ $P.crdnControl.query.fetchSize = $P.crdnControl.defaultFetchSize; $P.crdnControl.query.pageNum = $P.crdnControl.untilPageNum; @@ -547,7 +528,8 @@ $(document).ready(function(){ $("#btnDelete--${pageName}").on("click", () => $P.fnRemove()); $("#btnOpenCvlcptOrgnl--${pageName}").on("click", () => $P.fnOpenCvlcptOrgnl()); - $("#table-responsive--${pageName}").on("scrollend", function(){ $P.scrollEnd(this); }); + fnMakeScrollableTable($("#table-responsive--${pageName}")[0], $P.scrollCrdnList); + $("#DataTables_Table_0--${pageName}").find("th").resizable({handles : "e"}); /************************************************************************** diff --git a/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc04010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc04010-main.jsp index f06b0df9..2f3fbb3b 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc04010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc04010-main.jsp @@ -297,22 +297,6 @@ $(document).ready(function(){ $P.dmndControl.load(1); } - $P.scrollEnd = (obj) => { - if(obj.dataset.scrollStatus){ - return; - } - - var el = $(obj); - if(el.scrollTop() == 0){ - return; - } - if((el[0].scrollHeight - el.scrollTop() + VERTICAL_SCROLL_HEIGHT) <= el.outerHeight()){ - obj.dataset.scrollStatus = "waiting"; - $P.scrollDmndList(); - } - - } - $P.scrollDmndList = () => { $P.dmndControl.load($P.dmndControl.query.pageNum + 1); } @@ -342,15 +326,13 @@ $(document).ready(function(){ var found = document.getElementById("dmndRow--${pageName}").innerHTML; var replacer = (str, dataItem) => str .replace(/{onclick}/gi, "pageObject['${pageName}'].clickDmndList('" + dataItem.getValue("INDIV_ID") + "');"); + var trs = empty ? notFound : dmndList.inStrings(found, replacer); - $("#dmndTbody--${pageName}").html(trs.join()); + var noMore = (total == dmndList.length); + var initScroll = ($P.dmndControl.query.pageNum < 2) && ($P.dmndControl.untilPageNum == 0); + + $("#table-responsive--${pageName}")[0].changeContent(trs.join(), initScroll, noMore); - if(total == dmndList.length){ - $("#table-responsive--${pageName}").attr("data-scroll-status", "complete"); - } else { - $("#table-responsive--${pageName}").removeAttr("data-scroll-status"); - } - if($P.dmndControl.untilPageNum != 0){ $P.dmndControl.query.fetchSize = $P.dmndControl.defaultFetchSize; $P.dmndControl.query.pageNum = $P.dmndControl.untilPageNum; @@ -461,7 +443,8 @@ $(document).ready(function(){ $("#btnDelete--${pageName}").on("click", () => $P.fnRemove(null)); $("#btnDeleteAllCompleteData--${pageName}").on("click", () => $P.fnRemoveAllCompleteData()); - $("#table-responsive--${pageName}").on("scrollend", function(){ $P.scrollEnd(this); }); + fnMakeScrollableTable($("#table-responsive--${pageName}")[0], $P.scrollDmndList); + $("#DataTables_Table_0--${pageName}").find("th").resizable({handles : "e"}); /************************************************************************** diff --git a/src/main/webapp/WEB-INF/jsp/fims/levy/levy02010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/levy/levy02010-main.jsp index 9d7625b3..261cfc4a 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/levy/levy02010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/levy/levy02010-main.jsp @@ -244,23 +244,6 @@ $(document).ready(function(){ $P.rductControl.load(1); } - $P.scrollEnd = (obj) => { - if(obj.dataset.scrollStatus){ - return; - } - - var el = $(obj); - if(el.scrollTop() == 0){ - return; - } - - if((el[0].scrollHeight - el.scrollTop() + VERTICAL_SCROLL_HEIGHT) <= el.outerHeight()){ - obj.dataset.scrollStatus = "waiting"; - $P.scrollRductList(); - } - - } - $P.scrollRductList = () => { $P.rductControl.load($P.rductControl.query.pageNum + 1); } @@ -308,17 +291,15 @@ $(document).ready(function(){ .replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickRductList('" + dataItem.getValue("CRDN_ID") + "');"); var trs = empty ? notFound : rductList.inStrings(found,replacer); - - $("#rductTbody--${pageName}").html(trs.join()); + var noMore = (total == rductList.length); + var initScroll = ($P.rductControl.query.pageNum < 2) && ($P.rductControl.untilPageNum == 0); + + $("#table-responsive--${pageName}")[0].changeContent(trs.join(), initScroll, noMore); //보안모드 fn_securityModeToggle($("#securityMode--top").is(":checked")); - if(total == rductList.length){ - $("#table-responsive--${pageName}").attr("data-scroll-status", "complete"); - } else { - $("#table-responsive--${pageName}").removeAttr("data-scroll-status"); - } + if($P.rductControl.untilPageNum != 0){ $P.rductControl.query.fetchSize = $P.rductControl.defaultFetchSize; @@ -340,7 +321,8 @@ $(document).ready(function(){ **************************************************************************/ $('#btnReset--${pageName}').on('click', () => $P.fnReset()); $('#btnSearch--${pageName}').on('click', () => $P.searchRductList()); - $("#table-responsive--${pageName}").on("scrollend", function(){ $P.scrollEnd(this); }); + + fnMakeScrollableTable($("#table-responsive--${pageName}")[0], $P.scrollRductList); /************************************************************************** * 초기화 diff --git a/src/main/webapp/resources/js/fims/framework/cmm/componentization.js b/src/main/webapp/resources/js/fims/framework/cmm/componentization.js index 70faba17..7cdeaf33 100644 --- a/src/main/webapp/resources/js/fims/framework/cmm/componentization.js +++ b/src/main/webapp/resources/js/fims/framework/cmm/componentization.js @@ -160,4 +160,56 @@ function fnMakeRowNumberingTable(tbody, markerFinder, markerSetter){ }; var mo = new MutationObserver(moCallbackFunc); mo.observe(tbody, {childList : true}); +} + +/************************************************************************** +* 스크롤 테이블 +**************************************************************************/ +function fnMakeScrollableTable(tableScrollEl, thisScrollendEvent){ + + tableScrollEl.thisScrollendEvent = thisScrollendEvent; + + tableScrollEl.changeContent = function(content, initScrollPosition, noMore){ + var beforeRender = this.scrollTop; + + $(this).find("tbody").html(content); + + this.scrollTop = 0; + var min = this.scrollTop; + this.scrollTop = this.scrollHeight; + var max = this.scrollTop; + var hasScroll = (min != max); + + var more = document.createElement("tr"); + + if(hasScroll && !noMore){ + more.style.height = "30px"; + + $(this).find("tbody").append(more); + + var ioCallbackFunc = function(entries, observer){ + var entry = entries[0]; + var target = entry.target; + if(entry.isIntersecting){ + observer.unobserve(target); + tableScrollEl.thisScrollendEvent(); + } + }; + + var io = new IntersectionObserver(ioCallbackFunc, {threshold : 0.5}); + io.observe(more); + } + + if(initScrollPosition){ + this.scrollTop = 0; + } else { + + var afterRender = this.scrollTop; + + if(beforeRender < afterRender){ + this.scrollTop = beforeRender; + } + } + + }; } \ No newline at end of file