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

@ -65,7 +65,7 @@
<tbody name="ntcTbody">
</tbody>
<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-start">SGG_NM</td>
<td onclick ondblclick class="text-start">NTC_TTL</td>
@ -191,8 +191,8 @@ $(document).ready(function(){
var notFound = [$P.findn("ntcNotFound").innerHTML];
var found = $P.findn("ntcRow").innerHTML;
var replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickNtcList('" + dataItem.getValue("NTC_ID") + "');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickNtcList('" + dataItem.getValue("NTC_ID") + "');");
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickNtcList('{DATA-INDEX}');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickNtcList('{NTC_ID}');");
return {
found : found,
@ -215,14 +215,14 @@ $(document).ready(function(){
}
$P.clickNtcList = (dataKey) => {
if(dataKey == ""){
$P.clickNtcList = (dataIndex) => {
if(dataIndex == ""){
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) => {

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

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

@ -1,5 +1,6 @@
if(window.help !== undefined){
help.prototype.list.push("FimsSupport 클래스 : FIMS프로젝트 내에서 공통적으로 사용할 수 있는 기능 지원");
help.prototype.list.push("FimsPagingSupport 클래스 : 스크롤 페이징 정보 표시 지원");
}
/**************************************************************************
@ -523,18 +524,6 @@ class FimsPagingSupport extends PagingSupport {
}
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){
this._doq = conf.doq;
}

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

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

Loading…
Cancel
Save