datatable 스크롤 수정.

main
jjh 1 year ago
parent f22861f65f
commit 4a547f41aa

@ -468,10 +468,19 @@
});
// DataTables 스크롤 이벤트
$("#table-responsive--${pageName}").scroll(function() {
$("#table-responsive--${pageName}").scroll(function(obj) {
let el = $(this);
if (el.scrollTop() == 0) return;
if (el.scrollTop() == 0) {
return;
}
let itemsCnt = ${pageName}Control.dataset._items.length;
let totCnt = ${pageName}Control.dataset.getCurrent("item").data.TOT_CNT;
if (itemsCnt >= totCnt) {
return;
}
if ((el[0].scrollHeight - el.scrollTop() + VERTICAL_SCROLL_HEIGHT) <= el.outerHeight()) {
${pageName}Control.load(${pageName}Control.query.pageNum + 1);

@ -417,6 +417,27 @@
});
}
/**************************************************************************
*
**************************************************************************/
// DataTables에 click, dbclick 이벤트
renderList${pageName} = () => {
let ${infoPrefix}List = ${pageName}Control.dataset;
let empty = ${infoPrefix}List.empty;
let trs = empty ?
[document.getElementById("${infoPrefix}NotFound--${pageName}").innerHTML] : <%-- from template#${infoPrefix}NotFound --%>
${infoPrefix}List.inStrings(
document.getElementById("${infoPrefix}Row--${pageName}").innerHTML, <%-- from template#${infoPrefix}Row --%>
(str, dataItem) => str
.replace(/{onclick}/gi, "${pageName}Control.setCurrent('" + dataItem.getValue("OPNN_ID") + "');")
.replace(/{ondblclick}/gi, "${pageName}Control.getTotalInfo('" + dataItem.getValue("CRDN_ID") + "');")
);
$("#tbody--${pageName}").html(trs.join());
$("th input[type='checkbox']").prop("checked", false);
}
/**************************************************************************
* 초기 셋팅
**************************************************************************/
@ -447,33 +468,24 @@
});
// DataTables 스크롤 이벤트
$("#table-responsive--${pageName}").scroll(function() {
$("#table-responsive--${pageName}").scroll(function(obj) {
let el = $(this);
if (el.scrollTop() == 0) return;
if ((el[0].scrollHeight - el.scrollTop() + VERTICAL_SCROLL_HEIGHT) <= el.outerHeight()) {
fnBtnSearchList${pageName}(${pageName}Control.query.pageNum + 1);
if (el.scrollTop() == 0) {
return;
}
});
}
// DataTables에 click, dbclick 이벤트
function renderList${pageName}() {
let ${infoPrefix}List = ${pageName}Control.dataset;
let empty = ${infoPrefix}List.empty;
let itemsCnt = ${pageName}Control.dataset._items.length;
let totCnt = ${pageName}Control.dataset.getCurrent("item").data.TOT_CNT;
let trs = empty ?
[document.getElementById("${infoPrefix}NotFound--${pageName}").innerHTML] : <%-- from template#${infoPrefix}NotFound --%>
${infoPrefix}List.inStrings(
document.getElementById("${infoPrefix}Row--${pageName}").innerHTML, <%-- from template#${infoPrefix}Row --%>
(str, dataItem) => str
.replace(/{onclick}/gi, "${pageName}Control.setCurrent('" + dataItem.getValue("OPNN_ID") + "');")
.replace(/{ondblclick}/gi, "${pageName}Control.getTotalInfo('" + dataItem.getValue("CRDN_ID") + "');")
);
if (itemsCnt >= totCnt) {
return;
}
$("#tbody--${pageName}").html(trs.join());
$("th input[type='checkbox']").prop("checked", false);
if ((el[0].scrollHeight - el.scrollTop() + VERTICAL_SCROLL_HEIGHT) <= el.outerHeight()) {
${pageName}Control.load(${pageName}Control.query.pageNum + 1);
}
});
}
/**************************************************************************

@ -314,9 +314,6 @@
});
}
/**************************************************************************
*
**************************************************************************/
// 저장 callback
${pageName}Control.onSave = (resp) => {
if (resp.saved)
@ -334,6 +331,27 @@
});
}
/**************************************************************************
*
**************************************************************************/
// DataTables에 click, dbclick 이벤트
renderList${pageName} = () => {
let ${infoPrefix}List = ${pageName}Control.dataset;
let empty = ${infoPrefix}List.empty;
let trs = empty ?
[document.getElementById("${infoPrefix}NotFound--${pageName}").innerHTML] : <%-- from template#${infoPrefix}NotFound --%>
${infoPrefix}List.inStrings(
document.getElementById("${infoPrefix}Row--${pageName}").innerHTML, <%-- from template#${infoPrefix}Row --%>
(str, dataItem) => str
.replace(/{onclick}/gi, "${pageName}Control.setCurrent('" + dataItem.getValue("RE_REG_ID") + "');")
.replace(/{ondblclick}/gi, "${pageName}Control.getTotalInfo('" + dataItem.getValue("CRDN_ID") + "');")
);
$("#tbody--${pageName}").html(trs.join());
$("th input[type='checkbox']").prop("checked", false);
}
/**************************************************************************
* 초기 셋팅
**************************************************************************/
@ -363,33 +381,24 @@
});
// DataTables 스크롤 이벤트
$("#table-responsive--${pageName}").scroll(function() {
$("#table-responsive--${pageName}").scroll(function(obj) {
let el = $(this);
if (el.scrollTop() == 0) return;
if ((el[0].scrollHeight - el.scrollTop() + VERTICAL_SCROLL_HEIGHT) <= el.outerHeight()) {
fnBtnSearchList${pageName}(${pageName}Control.query.pageNum + 1);
if (el.scrollTop() == 0) {
return;
}
});
}
// DataTables에 click, dbclick 이벤트
function renderList${pageName}() {
let ${infoPrefix}List = ${pageName}Control.dataset;
let empty = ${infoPrefix}List.empty;
let itemsCnt = ${pageName}Control.dataset._items.length;
let totCnt = ${pageName}Control.dataset.getCurrent("item").data.TOT_CNT;
let trs = empty ?
[document.getElementById("${infoPrefix}NotFound--${pageName}").innerHTML] : <%-- from template#${infoPrefix}NotFound --%>
${infoPrefix}List.inStrings(
document.getElementById("${infoPrefix}Row--${pageName}").innerHTML, <%-- from template#${infoPrefix}Row --%>
(str, dataItem) => str
.replace(/{onclick}/gi, "${pageName}Control.setCurrent('" + dataItem.getValue("RE_REG_ID") + "');")
.replace(/{ondblclick}/gi, "${pageName}Control.getTotalInfo('" + dataItem.getValue("CRDN_ID") + "');")
);
if (itemsCnt >= totCnt) {
return;
}
$("#tbody--${pageName}").html(trs.join());
$("th input[type='checkbox']").prop("checked", false);
if ((el[0].scrollHeight - el.scrollTop() + VERTICAL_SCROLL_HEIGHT) <= el.outerHeight()) {
${pageName}Control.load(${pageName}Control.query.pageNum + 1);
}
});
}
/**************************************************************************

Loading…
Cancel
Save