DatasetControl keyMapper 설정 수정

main
이범준 3 months ago
parent 96c4b1b1dc
commit 08a96d32be

@ -11,7 +11,7 @@
<div class="table-responsive" style="overflow-x: scroll;height:500px;overflow-y: scroll;"> <div class="table-responsive" style="overflow-x: scroll;height:500px;overflow-y: scroll;">
<table name="backupSggTable" class="table-layout-fixed datatables-ajax table table-bordered dataTable no-footer"> <table name="backupSggTable" class="table-layout-fixed datatables-ajax table table-bordered dataTable no-footer">
<thead class="sticky-thead"> <thead class="sticky-thead">
<tr data-key="{SGG_CD}"> <tr>
<th style="width: 50px;"></th> <th style="width: 50px;"></th>
<th style="width: 140px;" >시군구코드</th> <th style="width: 140px;" >시군구코드</th>
<th style="width: 300px;" >시군구명</th> <th style="width: 300px;" >시군구명</th>
@ -43,7 +43,7 @@
style="overflow-x: scroll;height:500px;overflow-y: scroll;"> style="overflow-x: scroll;height:500px;overflow-y: scroll;">
<table class="table-layout-fixed datatables-ajax table table-bordered dataTable no-footer"> <table class="table-layout-fixed datatables-ajax table table-bordered dataTable no-footer">
<thead class="sticky-thead"> <thead class="sticky-thead">
<tr data-key="{SGG_CD}"> <tr>
<th style="width: 50px;"></th> <th style="width: 50px;"></th>
<th style="width: 140px;" >시군구코드</th> <th style="width: 140px;" >시군구코드</th>
<th style="width: 300px;" >시군구명</th> <th style="width: 300px;" >시군구명</th>
@ -64,9 +64,9 @@
<template is="curly-brackets" name="sggRow"> <template is="curly-brackets" name="sggRow">
<tr data-key="SGG_CD"> <tr data-index="DATA-INDEX">
<td onclick ondblclick class="text-center cmn"> <td onclick ondblclick class="text-center cmn">
<input type="checkbox" value="SGG_CD" /> <input type="checkbox" value="DATA-INDEX" />
</td> </td>
<td onclick ondblclick class="text-center cmn">SGG_CD</td> <td onclick ondblclick class="text-center cmn">SGG_CD</td>
<td onclick ondblclick class="text-center cmn">SGG_NM</td> <td onclick ondblclick class="text-center cmn">SGG_NM</td>
@ -88,10 +88,10 @@ $(document).ready(function(){
let $P = pageObject['${pageName}']; let $P = pageObject['${pageName}'];
$P.originalDataset = new Dataset({ $P.originalDataset = new Dataset({
keymapper : info => info ? info.SGG_CD : "" keys : ["SGG_CD"]
}); });
$P.backupDataset = new Dataset({ $P.backupDataset = new Dataset({
keymapper : info => info ? info.SGG_CD : "" keys : ["SGG_CD"]
}); });
$P.fnRenderBackupAndOriginal = (list,tbodyName, dataset) => { $P.fnRenderBackupAndOriginal = (list,tbodyName, dataset) => {
@ -136,7 +136,7 @@ $(document).ready(function(){
var arr = []; var arr = [];
checked.each(function(){ checked.each(function(){
arr.push(this.value); arr.push($P.backupDataset.getData(this.value).SGG_CD);
}); });
ajax.post({ ajax.post({
@ -162,7 +162,7 @@ $(document).ready(function(){
} }
var arr = []; var arr = [];
checked.each(function(){ checked.each(function(){
arr.push(this.value); arr.push($P.originalDataset.getData(this.value).SGG_CD);
}); });
ajax.post({ ajax.post({

@ -65,7 +65,7 @@
<tbody name="ntcTbody"> <tbody name="ntcTbody">
</tbody> </tbody>
<template is="curly-brackets" name="ntcRow"> <template is="curly-brackets" name="ntcRow">
<tr data-key="NTC_ID"> <tr data-index="DATA-INDEX">
<td onclick ondblclick class="text-end">ROW_NUM</td> <td onclick ondblclick class="text-end">ROW_NUM</td>
<td onclick ondblclick class="text-start">SGG_NM</td> <td onclick ondblclick class="text-start">SGG_NM</td>
<td onclick ondblclick class="text-start">NTC_TTL</td> <td onclick ondblclick class="text-start">NTC_TTL</td>
@ -191,8 +191,8 @@ $(document).ready(function(){
var notFound = [$P.findn("ntcNotFound").innerHTML]; var notFound = [$P.findn("ntcNotFound").innerHTML];
var found = $P.findn("ntcRow").innerHTML; var found = $P.findn("ntcRow").innerHTML;
var replacer = (str, dataItem) => str var replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickNtcList('" + dataItem.getValue("NTC_ID") + "');") .replace(/{onclick}/gi, "pageObject['${pageName}'].clickNtcList('{DATA-INDEX}');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickNtcList('" + dataItem.getValue("NTC_ID") + "');"); .replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickNtcList('{NTC_ID}');");
return { return {
found : found, found : found,
@ -215,14 +215,14 @@ $(document).ready(function(){
} }
$P.clickNtcList = (dataKey) => { $P.clickNtcList = (dataIndex) => {
if(dataKey == ""){ if(dataIndex == ""){
return; return;
} }
$P.$findn("ntcTbody").setCurrentRow(dataKey); $P.$findn("ntcTbody").setCurrentRow(dataIndex);
Apply.toDataset.current(ctrl.dataset, dataKey); Apply.toDataset.current(ctrl.dataset, dataIndex);
} }
$P.dblclickNtcList = (dataKey) => { $P.dblclickNtcList = (dataKey) => {

@ -70,8 +70,7 @@
<div class="card-datatable text-nowrap"> <div class="card-datatable text-nowrap">
<div name="DataTables_Table_0_wrapper" class="dataTables_wrapper dt-bootstrap5 no-footer"> <div name="DataTables_Table_0_wrapper" class="dataTables_wrapper dt-bootstrap5 no-footer">
<div name="table-responsive" class="table-responsive ox-scroll oy-scroll h-px-500"> <div name="table-responsive" class="table-responsive ox-scroll oy-scroll h-px-500">
<table name="deptTable" <table name="deptTable" class="table-layout-fixed datatables-ajax table table-bordered dataTable no-footer">
class="table-layout-fixed datatables-ajax table table-bordered dataTable no-footer">
<thead class="sticky-thead"> <thead class="sticky-thead">
<tr name="deptThead"> <tr name="deptThead">
<th style="width: 80px;" class="cmn">No.</th> <th style="width: 80px;" class="cmn">No.</th>
@ -92,11 +91,11 @@
<tbody name="deptTbody"> <tbody name="deptTbody">
</tbody> </tbody>
<template is="curly-brackets" name="deptRow"> <template is="curly-brackets" name="deptRow">
<tr data-key="DEPT_CD"> <tr data-index="DATA-INDEX">
<td onclick ondblclick class="text-end">ROW_NUM</td> <td onclick ondblclick class="text-end">ROW_NUM</td>
<td class="text-center"> <td class="text-center">
<input type="checkbox" class="form-check-input" name="gridCheckbox" value="DEPT_CD" <input type="checkbox" class="form-check-input" name="gridCheckbox" value="DATA-INDEX"
onchange="pageObject['${pageName}'].ctrl.dataset.select('{DEPT_CD}', this.checked);"> onchange="pageObject['${pageName}'].ctrl.dataset.select('{DATA-INDEX}', this.checked);">
</td> </td>
<td onclick ondblclick class="text-start">SGG_NM</td> <td onclick ondblclick class="text-start">SGG_NM</td>
<td onclick ondblclick class="text-center">SGG_CD</td> <td onclick ondblclick class="text-center">SGG_CD</td>
@ -175,7 +174,6 @@ $(document).ready(function(){
ctrl.dataset.onSelectionChange = (selectedArr) => { ctrl.dataset.onSelectionChange = (selectedArr) => {
Apply.fromDataset.gridCheckbox(ctrl.dataset, $P.findn("deptTbody"), 1, selectedArr); Apply.fromDataset.gridCheckbox(ctrl.dataset, $P.findn("deptTbody"), 1, selectedArr);
}; };
$P.pagingSupport = new FimsPagingSupport({ $P.pagingSupport = new FimsPagingSupport({
@ -227,8 +225,8 @@ $(document).ready(function(){
var notFound = [$P.findn("deptNotFound").innerHTML]; var notFound = [$P.findn("deptNotFound").innerHTML];
var found = $P.findn("deptRow").innerHTML; var found = $P.findn("deptRow").innerHTML;
var replacer = (str, dataItem) => str var replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickDeptList('" + dataItem.getValue("DEPT_CD") + "');") .replace(/{onclick}/gi, "pageObject['${pageName}'].clickDeptList('{DATA-INDEX}');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickDeptList('" + dataItem.getValue("DEPT_CD") + "');"); .replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickDeptList('{DEPT_CD}');");
return { return {
found : found, found : found,
@ -251,14 +249,14 @@ $(document).ready(function(){
} }
$P.clickDeptList = (dataKey) => { $P.clickDeptList = (dataIndex) => {
if(dataKey == ""){ if(dataIndex == ""){
return; return;
} }
$P.$findn("deptTbody").setCurrentRow(dataKey); $P.$findn("deptTbody").setCurrentRow(dataIndex);
Apply.toDataset.current(ctrl.dataset, dataKey); Apply.toDataset.current(ctrl.dataset, dataIndex);
} }
$P.dblclickDeptList = (dataKey) => { $P.dblclickDeptList = (dataKey) => {

@ -33,7 +33,7 @@
<tbody id="addrTbody"> <tbody id="addrTbody">
</tbody> </tbody>
<template id="addrRow"> <template id="addrRow">
<tr data-key="{TEMP_ID}"> <tr data-index="{DATA-INDEX}">
<td onclick="{onclick}" class="text-start"> <td onclick="{onclick}" class="text-start">
<strong class="fs-4">{roadAddr}</strong><br/>{jibunAddr} <strong class="fs-4">{roadAddr}</strong><br/>{jibunAddr}
</td> </td>
@ -84,8 +84,9 @@
**************************************************************************/ **************************************************************************/
var addrControl = new DatasetControl({ var addrControl = new DatasetControl({
urls : { load : "", getInfo : "" }, urls : { load : "", getInfo : "" },
dataGetter : obj => obj.juso, appendData:false, dataGetter : obj => obj.juso,
keymapper : info => info ? info.TEMP_ID : "", appendData:false,
keys : ["DATA-INDEX"],
formats: {} formats: {}
}); });
@ -113,7 +114,7 @@ function renderAddrList(total){
var notFound = [document.getElementById("addrNotFound").innerHTML]; var notFound = [document.getElementById("addrNotFound").innerHTML];
var found = document.getElementById("addrRow").innerHTML; var found = document.getElementById("addrRow").innerHTML;
var replacer = (str, dataItem) => str var replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "fnClickAddrList('" + dataItem.getValue("TEMP_ID") + "');") .replace(/{onclick}/gi, "fnClickAddrList('{DATA-INDEX}');")
var trs = empty ? notFound : addrList.inStrings(found, replacer); var trs = empty ? notFound : addrList.inStrings(found, replacer);
$("#addrTbody").html(trs.join()); $("#addrTbody").html(trs.join());
@ -143,11 +144,7 @@ function getAddr(pageNum){
alert(errCode+"="+errDesc); alert(errCode+"="+errDesc);
}else{ }else{
if(jsonStr != null){ if(jsonStr != null){
var tempId = 0;
jsonStr.results.juso.forEach((item) => item.TEMP_ID = (""+tempId++));
addrControl.setData(jsonStr.results); addrControl.setData(jsonStr.results);
} }
} }
} }
@ -197,14 +194,15 @@ function enterSearch() {
} }
} }
function fnClickAddrList(tempId){ function fnClickAddrList(dataIndex){
$("#formBottom").removeAttr("hidden"); $("#formBottom").removeAttr("hidden");
$("#mainAddr").html(""); $("#mainAddr").html("");
$("#etcAddr").val(""); $("#etcAddr").val("");
addrControl.dataset.setCurrent(tempId); addrControl.dataset.setCurrent(dataIndex);
$("#mainAddr").html(addrControl.dataset.getCurrent().roadAddr); $("#mainAddr").html(addrControl.dataset.getCurrent().roadAddr);
$("#addrTbody").setCurrentRow(tempId); $("#addrTbody").setCurrentRow(dataIndex);
$("#etcAddr").focus(); $("#etcAddr").focus();
} }

@ -1,5 +1,6 @@
if(window.help !== undefined){ if(window.help !== undefined){
help.prototype.list.push("FimsSupport 클래스 : FIMS프로젝트 내에서 공통적으로 사용할 수 있는 기능 지원"); help.prototype.list.push("FimsSupport 클래스 : FIMS프로젝트 내에서 공통적으로 사용할 수 있는 기능 지원");
help.prototype.list.push("FimsPagingSupport 클래스 : 스크롤 페이징 정보 표시 지원");
} }
/************************************************************************** /**************************************************************************
@ -522,19 +523,7 @@ class FimsPagingSupport extends PagingSupport {
conf.ctrl = new DatasetControl({}); conf.ctrl = new DatasetControl({});
} }
super(conf); super(conf);
//this.selector = conf.selector || null;
//this.ctrl = conf.ctrl;
//this.dataset = this.ctrl?.dataset;
//this._doq = conf.ctrl?.doq;
//this.prefix = conf.ctrl?.prefix;
//this.sizeOffset = conf.sizeOffset || 0;
//this.linkContainer = conf.linkContainer;
//this.func = conf.func;
//this.statusContainer = conf.statusContainer;
//this.statusContent = conf.statusContent;
if(conf.doq != null){ if(conf.doq != null){
this._doq = conf.doq; this._doq = conf.doq;
} }

@ -1,11 +1,12 @@
function newMngt01010Control(page, doctx = ""){ function newMngt01010Control(page, doctx = ""){
page.ctrl = new DatasetControl({ page.ctrl = new DatasetControl({
dataGetter : obj => obj["List"], appendData:true, dataGetter : obj => obj["List"],
keymapper : info => info ? info.NTC_ID : "", appendData:true,
keys : ["NTC_ID"],
urls : { urls : {
load : wctx.url("/mngt/mngt01/010/list.do"), load : wctx.url("/mngt/mngt01/010/list.do"),
getInfo : wctx.url("/mngt/mngt01/020/info.do") getInfo : wctx.url("/mngt/mngt01/020/info.do")
}, },
formats: { formats: {
REG_DT : datetimeFormat, REG_DT : datetimeFormat,
MDFCN_DT : datetimeFormat MDFCN_DT : datetimeFormat

@ -1,11 +1,12 @@
function newOgdp02020Control(page, doctx = ""){ function newOgdp02020Control(page, doctx = ""){
page.ctrl = new DatasetControl({ page.ctrl = new DatasetControl({
dataGetter : obj => obj["List"], appendData:true, dataGetter : obj => obj["List"],
keymapper : info => info ? info.DEPT_CD : "", appendData:true,
keys : ["DEPT_CD"],
urls : { urls : {
load : wctx.url("/ogdp/getDeptStngList.do"), load : wctx.url("/ogdp/getDeptStngList.do"),
getInfo : wctx.url("/ogdp/getDeptStngInfo.do") getInfo : wctx.url("/ogdp/getDeptStngInfo.do")
}, },
formats: { formats: {
REG_DT : datetimeFormat, REG_DT : datetimeFormat,
MDFCN_DT : datetimeFormat MDFCN_DT : datetimeFormat

Loading…
Cancel
Save