문자전송 > 엑셀불러오기 > 타이틀 간격 맞춤
@6c43799f2b13bd1f9af1f43c5fd4b7d72abe7241
--- src/main/webapp/WEB-INF/jsp/web/msgdata/include/msgDataIncludeExcel.jsp
+++ src/main/webapp/WEB-INF/jsp/web/msgdata/include/msgDataIncludeExcel.jsp
... | ... | @@ -49,7 +49,7 @@ |
| 49 | 49 |
cell.getRow().toggleSelect(); |
| 50 | 50 |
} |
| 51 | 51 |
}, |
| 52 |
- {formatter:"rownum", align:"center" ,title:"No", hozAlign:"center", headerHozAlign:"center", width:60},
|
|
| 52 |
+ {formatter:"rownum", align:"center" ,title:"No", hozAlign:"center", headerHozAlign:"center", width:40},
|
|
| 53 | 53 |
{title:"A", field:"A", hozAlign:"center", headerHozAlign: "center", width:140, validator:["maxLength:100", "string"]},
|
| 54 | 54 |
{title:"B", field:"B", hozAlign:"center", headerHozAlign: "center", width:140, validator:["maxLength:100", "string"]},
|
| 55 | 55 |
{title:"C", field:"C", hozAlign:"center", headerHozAlign: "center", width:140, validator:["maxLength:100", "string"]},
|
... | ... | @@ -68,6 +68,34 @@ |
| 68 | 68 |
return value % parameters.phone; |
| 69 | 69 |
}, |
| 70 | 70 |
}); |
| 71 |
+ |
|
| 72 |
+ |
|
| 73 |
+ |
|
| 74 |
+ |
|
| 75 |
+ // 타뷸레이터 width값 변경 시 위에 select width 값 변경 |
|
| 76 |
+ var titleArray = ["A","B","C","D","E","F"]; |
|
| 77 |
+ |
|
| 78 |
+ $tableExcel.on("columnWidth",function(column){
|
|
| 79 |
+ var titleIndex = titleArray.indexOf(column._column.definition.title); |
|
| 80 |
+ titleIndex += 1; |
|
| 81 |
+ if(titleIndex != 0){
|
|
| 82 |
+ $('.select_adr_hd>div').eq(titleIndex).css('width', column._column.width);
|
|
| 83 |
+ }else{
|
|
| 84 |
+ $('.select_adr_hd>div').eq(0).css('width', column._column.width + 40);
|
|
| 85 |
+ } |
|
| 86 |
+ }); |
|
| 87 |
+ |
|
| 88 |
+ $tableExcel.on("scrollHorizontal",function(left){
|
|
| 89 |
+ $(".adr_excel").scrollLeft(left);
|
|
| 90 |
+ }) |
|
| 91 |
+ |
|
| 92 |
+ |
|
| 93 |
+ $(".adr_excel").on("scroll",function(){
|
|
| 94 |
+ $(".tabulator-tableholder").scrollLeft($(this).scrollLeft());
|
|
| 95 |
+ }); |
|
| 96 |
+ |
|
| 97 |
+ |
|
| 98 |
+ |
|
| 71 | 99 |
|
| 72 | 100 |
$("#excelFile").on("change", function(event) {
|
| 73 | 101 |
var fileInfo = event.target.files; |
... | ... | @@ -91,6 +119,8 @@ |
| 91 | 119 |
// 대량등록 닫기 |
| 92 | 120 |
setAddrMassClose(); |
| 93 | 121 |
}); |
| 122 |
+ |
|
| 123 |
+ |
|
| 94 | 124 |
|
| 95 | 125 |
|
| 96 | 126 |
// 엑셀등록 닫기 |
... | ... | @@ -643,6 +673,9 @@ |
| 643 | 673 |
} |
| 644 | 674 |
} |
| 645 | 675 |
|
| 676 |
+ |
|
| 677 |
+ |
|
| 678 |
+ |
|
| 646 | 679 |
</script> |
| 647 | 680 |
|
| 648 | 681 |
<!-- 중복전화번호 data-tooltip:addrMassDupli_layer --> |
... | ... | @@ -775,7 +808,8 @@ |
| 775 | 808 |
|
| 776 | 809 |
|
| 777 | 810 |
|
| 778 |
- <div class="adr_excel" style="margin-top: 13px;"> |
|
| 811 |
+ <div class="adr_excel" style="margin-top: 13px; overflow-x:auto;"> |
|
| 812 |
+<!-- <div class="adr_excel" style="margin-top: 13px;"> --> |
|
| 779 | 813 |
<!-- thead --> |
| 780 | 814 |
<div class="adr_hd select_adr_hd" data-group="tableExcel"> |
| 781 | 815 |
<div style="width: 100px;"></div> |
--- src/main/webapp/js/web/addr/init.js
+++ src/main/webapp/js/web/addr/init.js
... | ... | @@ -1,264 +1,264 @@ |
| 1 |
- |
|
| 2 |
- |
|
| 3 |
-var tableErrorData = []; |
|
| 4 |
-var tableErrorCheckData = []; |
|
| 5 |
-var addrMassDupliSaveList = null; |
|
| 6 |
- |
|
| 7 |
-var gArrRestartIndex = 0; //배열 재시작카운드 |
|
| 8 |
-var gNameList = []; //치환문자 이름 |
|
| 9 |
-var gPhoneList = []; //받는사람 |
|
| 10 |
-var gInfo1List = []; //치환문자1 |
|
| 11 |
-var gInfo2List = []; //치환문자2 |
|
| 12 |
-var gInfo3List = []; //치환문자3 |
|
| 13 |
-var gInfo4List = []; //치환문자4 |
|
| 14 |
-var gMemoList = []; //메모 |
|
| 15 |
- |
|
| 16 |
- |
|
| 17 |
-var $tableExcel = null; //엑셀입력 탭 |
|
| 18 |
-var $tableClip = null; //붙여넣기 탭 |
|
| 19 |
-var $tableSelf = null; //붙여넣기 탭 |
|
| 20 |
- |
|
| 21 |
-var $tableError = null; //에러 팝업 영역 |
|
| 22 |
- |
|
| 23 |
-$(document).ready(function(){
|
|
| 24 |
- |
|
| 25 |
- //Tabulator AJAX Data Loading |
|
| 26 |
- $tableExcel = new Tabulator("#tabulator_excel", {
|
|
| 27 |
- height:"255px", |
|
| 28 |
- width:"100%", |
|
| 29 |
- layout:"fitColumns", |
|
| 30 |
- autoColumns:false, |
|
| 31 |
- headerHozAlign:"center", |
|
| 32 |
- validationMode:"highlight", |
|
| 33 |
- clipboard:false, |
|
| 34 |
- clipboardCopySelector:"table", |
|
| 35 |
- clipboardPasteAction:"insert", // insert, update, replace |
|
| 36 |
- placeholder:"Excel 파일을 업로드 해주세요.", //fit columns to width of table (optional) |
|
| 37 |
- columns:[ //Define Table Columns |
|
| 38 |
- {formatter:"rowSelection", titleFormatter:"rowSelection",clipboard:false, hozAlign:"center", headerSort:false, cellClick:function(e, cell){
|
|
| 39 |
- cell.getRow().toggleSelect(); |
|
| 40 |
- } |
|
| 41 |
- }, |
|
| 42 |
- {formatter:"rownum", hozAlign:"center" ,title:"No", hozAlign:"center", headerHozAlign:"center", width:40},
|
|
| 43 |
- {title:"A", field:"A", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 44 |
- {title:"B", field:"B", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 45 |
- {title:"C", field:"C", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 46 |
- {title:"D", field:"D", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 47 |
- {title:"E", field:"E", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 48 |
- {title:"F", field:"F", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 49 |
- {title:"G", field:"G", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]}
|
|
| 50 |
- ], |
|
| 51 |
- validationFailed:function(cell, value, parameters){ // 유효성 체크 함수
|
|
| 52 |
- var valid = cell.isValid(); |
|
| 53 |
- if(!valid){
|
|
| 54 |
- alert("양식에 맞지 않는 정보가 입력되었습니다.");
|
|
| 55 |
- |
|
| 56 |
- //해당 셀 데이터 삭제 |
|
| 57 |
- cell.setValue("");
|
|
| 58 |
- } |
|
| 59 |
- return value % parameters.phone; |
|
| 60 |
- }, |
|
| 61 |
- }); |
|
| 62 |
- |
|
| 63 |
- |
|
| 64 |
- |
|
| 65 |
- |
|
| 66 |
- |
|
| 67 |
- $tableClip = new Tabulator("#tabulator_clip", {
|
|
| 68 |
- height:"255px", |
|
| 69 |
- width:"100%", |
|
| 70 |
- layout:"fitColumns", |
|
| 71 |
- editor:true, |
|
| 72 |
- headerHozAlign:"center", |
|
| 73 |
- validationMode:"highlight", |
|
| 74 |
- placeholder:"복사(Ctrl+C)한 내용을 여기에 붙여넣기(Ctrl+V) 해주세요.", //fit columns to width of table (optional) |
|
| 75 |
-// clipboard:true, // 클립보드 기능 활성화 |
|
| 76 |
- clipboardPasteAction:"update", // insert, update, replace |
|
| 77 |
- columns: [ |
|
| 78 |
- {formatter: "rowSelection", titleFormatter: "rowSelection", clipboard: false, hozAlign: "center", headerHozAlign: "center", headerSort: false, cellClick: function(e, cell) {
|
|
| 79 |
- cell.getRow().toggleSelect(); |
|
| 80 |
- }}, |
|
| 81 |
- {formatter:"rownum", hozAlign:"center" ,title:"No", hozAlign:"center", headerHozAlign:"center", width:40},
|
|
| 82 |
- {title:"A", field:"A", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 83 |
- {title:"B", field:"B", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 84 |
- {title:"C", field:"C", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 85 |
- {title:"D", field:"D", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 86 |
- {title:"E", field:"E", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 87 |
- {title:"F", field:"F", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 88 |
- {title:"G", field:"G", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]}
|
|
| 89 |
- ], |
|
| 90 |
- validationFailed: function(cell, value, parameters) {
|
|
| 91 |
- var valid = cell.isValid(); |
|
| 92 |
- if (!valid) {
|
|
| 93 |
- alert("양식에 맞지 않는 정보가 입력되었습니다.");
|
|
| 94 |
- cell.setValue(""); // 해당 셀 데이터 삭제
|
|
| 95 |
- } |
|
| 96 |
- return false; // 유효하지 않은 경우 false 반환 |
|
| 97 |
- }, |
|
| 98 |
- }); |
|
| 99 |
- |
|
| 100 |
- |
|
| 101 |
- |
|
| 102 |
- // 사용자 정의 필터 설정: addrPhoneNo가 빈 값이나 undefined가 아닌 경우 |
|
| 103 |
-// $tableSelf.setFilter(function(data, filterParams) {
|
|
| 104 |
-// var value = data.addrPhoneNo; |
|
| 105 |
-// return value !== "" && value !== undefined; // 빈 문자열과 undefined가 아닌 경우 |
|
| 106 |
-// }); |
|
| 107 |
- |
|
| 108 |
-// // 테이블의 셀 편집 후 이벤트를 등록 |
|
| 109 |
-// document.addEventListener('keydown', function(e) {
|
|
| 110 |
-// if(e.key === "Tab") {
|
|
| 111 |
-// e.preventDefault(); |
|
| 112 |
-// let selectedCells = $tableSelf.getSelectedCells(); |
|
| 113 |
-// let cell = selectedCells[selectedCells.length - 1]; // 현재 선택된 셀 가져오기 |
|
| 114 |
-// |
|
| 115 |
-// if (cell) {
|
|
| 116 |
-// let row = cell.getRow(); |
|
| 117 |
-// let table = cell.getTable(); |
|
| 118 |
-// let nextCell = cell.getNextCell("tab");
|
|
| 119 |
-// |
|
| 120 |
-// if (!nextCell && row === table.getRows().slice(-1)[0]) {
|
|
| 121 |
-// // 현재 셀이 마지막 행의 마지막 셀인 경우 |
|
| 122 |
-// table.addRow({A: "", B: "", C: "", D: "", E: "", F: "", G: ""}, false).then(function() {
|
|
| 123 |
-// table.scrollToRow(table.getRows().slice(-1)[0]); // 새로 추가된 행으로 스크롤 |
|
| 124 |
-// table.setActiveCell(table.getRows().slice(-1)[0].getCell("A")); // 새로운 행의 첫 번째 셀에 포커스
|
|
| 125 |
-// }); |
|
| 126 |
-// } |
|
| 127 |
-// } |
|
| 128 |
-// } |
|
| 129 |
-// }); |
|
| 130 |
-// |
|
| 131 |
- |
|
| 132 |
- //Tabulator AJAX Data Loading |
|
| 133 |
- $tableError = new Tabulator("#tabulator_error", {
|
|
| 134 |
- height:"255px", |
|
| 135 |
- width:"100%", |
|
| 136 |
- layout:"fitColumns", |
|
| 137 |
- autoColumns:false, |
|
| 138 |
- headerHozAlign:"center", |
|
| 139 |
- validationMode:"highlight", |
|
| 140 |
- clipboard:false, |
|
| 141 |
- clipboardCopySelector:"table", |
|
| 142 |
- clipboardPasteAction:"insert", // insert, update, replace |
|
| 143 |
- placeholder:"등록 팝업에서 휴대폰을 선택 후 확인해주세요.", //fit columns to width of table (optional) |
|
| 144 |
- columns:[ //Define Table Columns |
|
| 145 |
- {title:"이름", field:"name", hozAlign:"center", headerHozAlign: "center", width:125},
|
|
| 146 |
- {title:"휴대폰", field:"phone", hozAlign:"center", headerHozAlign: "center", width:158},
|
|
| 147 |
- {title:"미등록 결과", field:"result", hozAlign:"center", headerHozAlign: "center", width:125}
|
|
| 148 |
- ] |
|
| 149 |
- }); |
|
| 150 |
- |
|
| 151 |
- // 직접입력 타블레이터 |
|
| 152 |
- fn_selfmakeTable() |
|
| 153 |
- |
|
| 154 |
- |
|
| 155 |
- // 타뷸레이터 width값 변경 시 위에 select width 값 변경 |
|
| 156 |
- var titleArray = ["A","B","C","D","E","F","G"]; |
|
| 157 |
- |
|
| 158 |
- $tableExcel.on("columnWidth",function(column){
|
|
| 159 |
- var titleIndex = titleArray.indexOf(column._column.definition.title); |
|
| 160 |
- titleIndex += 1; |
|
| 161 |
- if(titleIndex != 0){
|
|
| 162 |
- $('.tableExcel .select_adr_hd>div').eq(titleIndex).css('width', column._column.width);
|
|
| 163 |
- }else{
|
|
| 164 |
- $('.tableExcel .select_adr_hd>div').eq(0).css('width', column._column.width + 40);
|
|
| 165 |
- } |
|
| 166 |
- }); |
|
| 167 |
- |
|
| 168 |
- $tableExcel.on("scrollHorizontal",function(left){
|
|
| 169 |
- $(".tableExcel .adr_excel").scrollLeft(left);
|
|
| 170 |
- }) |
|
| 171 |
- |
|
| 172 |
- |
|
| 173 |
- $(".tableExcel .adr_excel").on("scroll",function(){
|
|
| 174 |
- $(".tableExcel .tabulator-tableholder").scrollLeft($(this).scrollLeft());
|
|
| 175 |
- }); |
|
| 176 |
- |
|
| 177 |
- |
|
| 178 |
- |
|
| 179 |
- |
|
| 180 |
- $tableClip.on("columnWidth",function(column){
|
|
| 181 |
- var titleIndex = titleArray.indexOf(column._column.definition.title); |
|
| 182 |
- titleIndex += 1; |
|
| 183 |
- if(titleIndex != 0){
|
|
| 184 |
- $('.tableClip .select_adr_hd>div').eq(titleIndex).css('width', column._column.width);
|
|
| 185 |
- }else{
|
|
| 186 |
- $('.tableClip .select_adr_hd>div').eq(0).css('width', column._column.width + 40);
|
|
| 187 |
- } |
|
| 188 |
- }); |
|
| 189 |
- |
|
| 190 |
- $tableClip.on("scrollHorizontal",function(left){
|
|
| 191 |
- $(".tableClip .adr_excel").scrollLeft(left);
|
|
| 192 |
- }) |
|
| 193 |
- |
|
| 194 |
- $(".tableClip .adr_excel").on("scroll",function(){
|
|
| 195 |
- $(".tableClip .tabulator-tableholder").scrollLeft($(this).scrollLeft());
|
|
| 196 |
- }); |
|
| 197 |
- |
|
| 198 |
- |
|
| 199 |
- |
|
| 200 |
-}); |
|
| 201 |
- |
|
| 202 |
- |
|
| 203 |
-function fn_ClipMakeTable(){
|
|
| 204 |
-} |
|
| 205 |
- |
|
| 206 |
- |
|
| 207 |
-function fn_selfmakeTable(){
|
|
| 208 |
- |
|
| 209 |
- var tableData = []; |
|
| 210 |
- for (var i = 0; i < 1000; i++) {
|
|
| 211 |
- tableData.push({addrNm: "", addrPhoneNo: "", addrInfo1: "", addrInfo2: "", addrInfo3: "", addrInfo4: "", addrComment: ""});
|
|
| 212 |
- } |
|
| 213 |
- |
|
| 214 |
- // 테이블 초기화 |
|
| 215 |
- $tableSelf = new Tabulator("#tabulator_self", {
|
|
| 216 |
- height: "255px", |
|
| 217 |
- width: "100%", |
|
| 218 |
- layout: "fitColumns", |
|
| 219 |
- clipboardPasteAction: "update", |
|
| 220 |
- keybindings: {
|
|
| 221 |
- "navRight": "tab", // Tab 키를 누르면 오른쪽 셀로 이동 |
|
| 222 |
- "navLeft": "shift+tab", |
|
| 223 |
- "editNext": false // Tab 키를 누를 때 편집 모드를 종료하지 않도록 설정 |
|
| 224 |
- }, |
|
| 225 |
- data: tableData, |
|
| 226 |
- columns: [ |
|
| 227 |
- {formatter: "rowSelection", titleFormatter: "rowSelection", clipboard: false, hozAlign: "center", headerHozAlign: "center", headerSort: false, cellClick: function(e, cell) {
|
|
| 228 |
- cell.getRow().toggleSelect(); |
|
| 229 |
- }}, |
|
| 230 |
- {formatter:"rownum", hozAlign:"center" ,title:"No", headerHozAlign:"center", width:40},
|
|
| 231 |
- {title:"이름", field:"addrNm", hozAlign:"center", headerHozAlign: "center", width:119, validator:["maxLength:100"], editor:"input"},
|
|
| 232 |
- {title:"휴대폰", field:"addrPhoneNo", hozAlign:"center", headerHozAlign: "center", width:119, validator:["maxLength:100"], editor:"input"
|
|
| 233 |
- , cellEdited:function(cell){
|
|
| 234 |
- var currentValue = cell.getValue(); |
|
| 235 |
- console.log('cell.getValue() : ', currentValue);
|
|
| 236 |
- |
|
| 237 |
- // 현재 값이 null 또는 undefined가 아니고, 값이 변경된 경우에만 처리 |
|
| 238 |
- if (currentValue !== null |
|
| 239 |
- && currentValue !== '' |
|
| 240 |
- ) {
|
|
| 241 |
- var newValue = fn_selfUpdataCount(currentValue); |
|
| 242 |
- |
|
| 243 |
- // 값이 실제로 변경된 경우에만 setValue 호출 |
|
| 244 |
- if (currentValue !== newValue) {
|
|
| 245 |
- cell.setValue(newValue); |
|
| 246 |
- } |
|
| 247 |
- } |
|
| 248 |
- } |
|
| 249 |
- }, |
|
| 250 |
- {title:"[*1*]", field:"addrInfo1", hozAlign:"center", headerHozAlign: "center", width:119, validator:["maxLength:100"], editor:"input"},
|
|
| 251 |
- {title:"[*2*]", field:"addrInfo2", hozAlign:"center", headerHozAlign: "center", width:119, validator:["maxLength:100"], editor:"input"},
|
|
| 252 |
- {title:"[*3*]", field:"addrInfo3", hozAlign:"center", headerHozAlign: "center", width:119, validator:["maxLength:100"], editor:"input"},
|
|
| 253 |
- {title:"[*4*]", field:"addrInfo4", hozAlign:"center", headerHozAlign: "center", width:119, validator:["maxLength:100"], editor:"input"},
|
|
| 254 |
- {title:"메모", field:"addrComment", hozAlign:"center", headerHozAlign: "center", width:119, validator:["maxLength:100"], editor:"input"}
|
|
| 255 |
- ], |
|
| 256 |
- navigation: true // 키보드 탐색 활성화 |
|
| 257 |
- }); |
|
| 258 |
-} |
|
| 259 |
- |
|
| 260 |
- |
|
| 261 |
- |
|
| 262 |
- |
|
| 263 |
- |
|
| 264 |
- |
|
| 1 |
+ |
|
| 2 |
+ |
|
| 3 |
+var tableErrorData = []; |
|
| 4 |
+var tableErrorCheckData = []; |
|
| 5 |
+var addrMassDupliSaveList = null; |
|
| 6 |
+ |
|
| 7 |
+var gArrRestartIndex = 0; //배열 재시작카운드 |
|
| 8 |
+var gNameList = []; //치환문자 이름 |
|
| 9 |
+var gPhoneList = []; //받는사람 |
|
| 10 |
+var gInfo1List = []; //치환문자1 |
|
| 11 |
+var gInfo2List = []; //치환문자2 |
|
| 12 |
+var gInfo3List = []; //치환문자3 |
|
| 13 |
+var gInfo4List = []; //치환문자4 |
|
| 14 |
+var gMemoList = []; //메모 |
|
| 15 |
+ |
|
| 16 |
+ |
|
| 17 |
+var $tableExcel = null; //엑셀입력 탭 |
|
| 18 |
+var $tableClip = null; //붙여넣기 탭 |
|
| 19 |
+var $tableSelf = null; //붙여넣기 탭 |
|
| 20 |
+ |
|
| 21 |
+var $tableError = null; //에러 팝업 영역 |
|
| 22 |
+ |
|
| 23 |
+$(document).ready(function(){
|
|
| 24 |
+ |
|
| 25 |
+ //Tabulator AJAX Data Loading |
|
| 26 |
+ $tableExcel = new Tabulator("#tabulator_excel", {
|
|
| 27 |
+ height:"255px", |
|
| 28 |
+ width:"100%", |
|
| 29 |
+ layout:"fitColumns", |
|
| 30 |
+ autoColumns:false, |
|
| 31 |
+ headerHozAlign:"center", |
|
| 32 |
+ validationMode:"highlight", |
|
| 33 |
+ clipboard:false, |
|
| 34 |
+ clipboardCopySelector:"table", |
|
| 35 |
+ clipboardPasteAction:"insert", // insert, update, replace |
|
| 36 |
+ placeholder:"Excel 파일을 업로드 해주세요.", //fit columns to width of table (optional) |
|
| 37 |
+ columns:[ //Define Table Columns |
|
| 38 |
+ {formatter:"rowSelection", titleFormatter:"rowSelection",clipboard:false, hozAlign:"center", headerSort:false, cellClick:function(e, cell){
|
|
| 39 |
+ cell.getRow().toggleSelect(); |
|
| 40 |
+ } |
|
| 41 |
+ }, |
|
| 42 |
+ {formatter:"rownum", hozAlign:"center" ,title:"No", hozAlign:"center", headerHozAlign:"center", width:40},
|
|
| 43 |
+ {title:"A", field:"A", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 44 |
+ {title:"B", field:"B", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 45 |
+ {title:"C", field:"C", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 46 |
+ {title:"D", field:"D", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 47 |
+ {title:"E", field:"E", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 48 |
+ {title:"F", field:"F", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 49 |
+ {title:"G", field:"G", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]}
|
|
| 50 |
+ ], |
|
| 51 |
+ validationFailed:function(cell, value, parameters){ // 유효성 체크 함수
|
|
| 52 |
+ var valid = cell.isValid(); |
|
| 53 |
+ if(!valid){
|
|
| 54 |
+ alert("양식에 맞지 않는 정보가 입력되었습니다.");
|
|
| 55 |
+ |
|
| 56 |
+ //해당 셀 데이터 삭제 |
|
| 57 |
+ cell.setValue("");
|
|
| 58 |
+ } |
|
| 59 |
+ return value % parameters.phone; |
|
| 60 |
+ }, |
|
| 61 |
+ }); |
|
| 62 |
+ |
|
| 63 |
+ |
|
| 64 |
+ |
|
| 65 |
+ |
|
| 66 |
+ |
|
| 67 |
+ $tableClip = new Tabulator("#tabulator_clip", {
|
|
| 68 |
+ height:"255px", |
|
| 69 |
+ width:"100%", |
|
| 70 |
+ layout:"fitColumns", |
|
| 71 |
+ editor:true, |
|
| 72 |
+ headerHozAlign:"center", |
|
| 73 |
+ validationMode:"highlight", |
|
| 74 |
+ placeholder:"복사(Ctrl+C)한 내용을 여기에 붙여넣기(Ctrl+V) 해주세요.", //fit columns to width of table (optional) |
|
| 75 |
+// clipboard:true, // 클립보드 기능 활성화 |
|
| 76 |
+ clipboardPasteAction:"update", // insert, update, replace |
|
| 77 |
+ columns: [ |
|
| 78 |
+ {formatter: "rowSelection", titleFormatter: "rowSelection", clipboard: false, hozAlign: "center", headerHozAlign: "center", headerSort: false, cellClick: function(e, cell) {
|
|
| 79 |
+ cell.getRow().toggleSelect(); |
|
| 80 |
+ }}, |
|
| 81 |
+ {formatter:"rownum", hozAlign:"center" ,title:"No", hozAlign:"center", headerHozAlign:"center", width:40},
|
|
| 82 |
+ {title:"A", field:"A", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 83 |
+ {title:"B", field:"B", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 84 |
+ {title:"C", field:"C", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 85 |
+ {title:"D", field:"D", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 86 |
+ {title:"E", field:"E", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 87 |
+ {title:"F", field:"F", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
| 88 |
+ {title:"G", field:"G", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]}
|
|
| 89 |
+ ], |
|
| 90 |
+ validationFailed: function(cell, value, parameters) {
|
|
| 91 |
+ var valid = cell.isValid(); |
|
| 92 |
+ if (!valid) {
|
|
| 93 |
+ alert("양식에 맞지 않는 정보가 입력되었습니다.");
|
|
| 94 |
+ cell.setValue(""); // 해당 셀 데이터 삭제
|
|
| 95 |
+ } |
|
| 96 |
+ return false; // 유효하지 않은 경우 false 반환 |
|
| 97 |
+ }, |
|
| 98 |
+ }); |
|
| 99 |
+ |
|
| 100 |
+ |
|
| 101 |
+ |
|
| 102 |
+ // 사용자 정의 필터 설정: addrPhoneNo가 빈 값이나 undefined가 아닌 경우 |
|
| 103 |
+// $tableSelf.setFilter(function(data, filterParams) {
|
|
| 104 |
+// var value = data.addrPhoneNo; |
|
| 105 |
+// return value !== "" && value !== undefined; // 빈 문자열과 undefined가 아닌 경우 |
|
| 106 |
+// }); |
|
| 107 |
+ |
|
| 108 |
+// // 테이블의 셀 편집 후 이벤트를 등록 |
|
| 109 |
+// document.addEventListener('keydown', function(e) {
|
|
| 110 |
+// if(e.key === "Tab") {
|
|
| 111 |
+// e.preventDefault(); |
|
| 112 |
+// let selectedCells = $tableSelf.getSelectedCells(); |
|
| 113 |
+// let cell = selectedCells[selectedCells.length - 1]; // 현재 선택된 셀 가져오기 |
|
| 114 |
+// |
|
| 115 |
+// if (cell) {
|
|
| 116 |
+// let row = cell.getRow(); |
|
| 117 |
+// let table = cell.getTable(); |
|
| 118 |
+// let nextCell = cell.getNextCell("tab");
|
|
| 119 |
+// |
|
| 120 |
+// if (!nextCell && row === table.getRows().slice(-1)[0]) {
|
|
| 121 |
+// // 현재 셀이 마지막 행의 마지막 셀인 경우 |
|
| 122 |
+// table.addRow({A: "", B: "", C: "", D: "", E: "", F: "", G: ""}, false).then(function() {
|
|
| 123 |
+// table.scrollToRow(table.getRows().slice(-1)[0]); // 새로 추가된 행으로 스크롤 |
|
| 124 |
+// table.setActiveCell(table.getRows().slice(-1)[0].getCell("A")); // 새로운 행의 첫 번째 셀에 포커스
|
|
| 125 |
+// }); |
|
| 126 |
+// } |
|
| 127 |
+// } |
|
| 128 |
+// } |
|
| 129 |
+// }); |
|
| 130 |
+// |
|
| 131 |
+ |
|
| 132 |
+ //Tabulator AJAX Data Loading |
|
| 133 |
+ $tableError = new Tabulator("#tabulator_error", {
|
|
| 134 |
+ height:"255px", |
|
| 135 |
+ width:"100%", |
|
| 136 |
+ layout:"fitColumns", |
|
| 137 |
+ autoColumns:false, |
|
| 138 |
+ headerHozAlign:"center", |
|
| 139 |
+ validationMode:"highlight", |
|
| 140 |
+ clipboard:false, |
|
| 141 |
+ clipboardCopySelector:"table", |
|
| 142 |
+ clipboardPasteAction:"insert", // insert, update, replace |
|
| 143 |
+ placeholder:"등록 팝업에서 휴대폰을 선택 후 확인해주세요.", //fit columns to width of table (optional) |
|
| 144 |
+ columns:[ //Define Table Columns |
|
| 145 |
+ {title:"이름", field:"name", hozAlign:"center", headerHozAlign: "center", width:125},
|
|
| 146 |
+ {title:"휴대폰", field:"phone", hozAlign:"center", headerHozAlign: "center", width:158},
|
|
| 147 |
+ {title:"미등록 결과", field:"result", hozAlign:"center", headerHozAlign: "center", width:125}
|
|
| 148 |
+ ] |
|
| 149 |
+ }); |
|
| 150 |
+ |
|
| 151 |
+ // 직접입력 타블레이터 |
|
| 152 |
+ fn_selfmakeTable() |
|
| 153 |
+ |
|
| 154 |
+ |
|
| 155 |
+ // 타뷸레이터 width값 변경 시 위에 select width 값 변경 |
|
| 156 |
+ var titleArray = ["A","B","C","D","E","F","G"]; |
|
| 157 |
+ |
|
| 158 |
+ $tableExcel.on("columnWidth",function(column){
|
|
| 159 |
+ var titleIndex = titleArray.indexOf(column._column.definition.title); |
|
| 160 |
+ titleIndex += 1; |
|
| 161 |
+ if(titleIndex != 0){
|
|
| 162 |
+ $('.tableExcel .select_adr_hd>div').eq(titleIndex).css('width', column._column.width);
|
|
| 163 |
+ }else{
|
|
| 164 |
+ $('.tableExcel .select_adr_hd>div').eq(0).css('width', column._column.width + 40);
|
|
| 165 |
+ } |
|
| 166 |
+ }); |
|
| 167 |
+ |
|
| 168 |
+ $tableExcel.on("scrollHorizontal",function(left){
|
|
| 169 |
+ $(".tableExcel .adr_excel").scrollLeft(left);
|
|
| 170 |
+ }) |
|
| 171 |
+ |
|
| 172 |
+ |
|
| 173 |
+ $(".tableExcel .adr_excel").on("scroll",function(){
|
|
| 174 |
+ $(".tableExcel .tabulator-tableholder").scrollLeft($(this).scrollLeft());
|
|
| 175 |
+ }); |
|
| 176 |
+ |
|
| 177 |
+ |
|
| 178 |
+ |
|
| 179 |
+ |
|
| 180 |
+ $tableClip.on("columnWidth",function(column){
|
|
| 181 |
+ var titleIndex = titleArray.indexOf(column._column.definition.title); |
|
| 182 |
+ titleIndex += 1; |
|
| 183 |
+ if(titleIndex != 0){
|
|
| 184 |
+ $('.tableClip .select_adr_hd>div').eq(titleIndex).css('width', column._column.width);
|
|
| 185 |
+ }else{
|
|
| 186 |
+ $('.tableClip .select_adr_hd>div').eq(0).css('width', column._column.width + 40);
|
|
| 187 |
+ } |
|
| 188 |
+ }); |
|
| 189 |
+ |
|
| 190 |
+ $tableClip.on("scrollHorizontal",function(left){
|
|
| 191 |
+ $(".tableClip .adr_excel").scrollLeft(left);
|
|
| 192 |
+ }) |
|
| 193 |
+ |
|
| 194 |
+ $(".tableClip .adr_excel").on("scroll",function(){
|
|
| 195 |
+ $(".tableClip .tabulator-tableholder").scrollLeft($(this).scrollLeft());
|
|
| 196 |
+ }); |
|
| 197 |
+ |
|
| 198 |
+ |
|
| 199 |
+ |
|
| 200 |
+}); |
|
| 201 |
+ |
|
| 202 |
+ |
|
| 203 |
+function fn_ClipMakeTable(){
|
|
| 204 |
+} |
|
| 205 |
+ |
|
| 206 |
+ |
|
| 207 |
+function fn_selfmakeTable(){
|
|
| 208 |
+ |
|
| 209 |
+ var tableData = []; |
|
| 210 |
+ for (var i = 0; i < 1000; i++) {
|
|
| 211 |
+ tableData.push({addrNm: "", addrPhoneNo: "", addrInfo1: "", addrInfo2: "", addrInfo3: "", addrInfo4: "", addrComment: ""});
|
|
| 212 |
+ } |
|
| 213 |
+ |
|
| 214 |
+ // 테이블 초기화 |
|
| 215 |
+ $tableSelf = new Tabulator("#tabulator_self", {
|
|
| 216 |
+ height: "255px", |
|
| 217 |
+ width: "100%", |
|
| 218 |
+ layout: "fitColumns", |
|
| 219 |
+ clipboardPasteAction: "update", |
|
| 220 |
+ keybindings: {
|
|
| 221 |
+ "navRight": "tab", // Tab 키를 누르면 오른쪽 셀로 이동 |
|
| 222 |
+ "navLeft": "shift+tab", |
|
| 223 |
+ "editNext": false // Tab 키를 누를 때 편집 모드를 종료하지 않도록 설정 |
|
| 224 |
+ }, |
|
| 225 |
+ data: tableData, |
|
| 226 |
+ columns: [ |
|
| 227 |
+ {formatter: "rowSelection", titleFormatter: "rowSelection", clipboard: false, hozAlign: "center", headerHozAlign: "center", headerSort: false, cellClick: function(e, cell) {
|
|
| 228 |
+ cell.getRow().toggleSelect(); |
|
| 229 |
+ }}, |
|
| 230 |
+ {formatter:"rownum", hozAlign:"center" ,title:"No", headerHozAlign:"center", width:40},
|
|
| 231 |
+ {title:"이름", field:"addrNm", hozAlign:"center", headerHozAlign: "center", width:119, validator:["maxLength:100"], editor:"input"},
|
|
| 232 |
+ {title:"휴대폰", field:"addrPhoneNo", hozAlign:"center", headerHozAlign: "center", width:119, validator:["maxLength:100"], editor:"input"
|
|
| 233 |
+ , cellEdited:function(cell){
|
|
| 234 |
+ var currentValue = cell.getValue(); |
|
| 235 |
+ console.log('cell.getValue() : ', currentValue);
|
|
| 236 |
+ |
|
| 237 |
+ // 현재 값이 null 또는 undefined가 아니고, 값이 변경된 경우에만 처리 |
|
| 238 |
+ if (currentValue !== null |
|
| 239 |
+ && currentValue !== '' |
|
| 240 |
+ ) {
|
|
| 241 |
+ var newValue = fn_selfUpdataCount(currentValue); |
|
| 242 |
+ |
|
| 243 |
+ // 값이 실제로 변경된 경우에만 setValue 호출 |
|
| 244 |
+ if (currentValue !== newValue) {
|
|
| 245 |
+ cell.setValue(newValue); |
|
| 246 |
+ } |
|
| 247 |
+ } |
|
| 248 |
+ } |
|
| 249 |
+ }, |
|
| 250 |
+ {title:"[*1*]", field:"addrInfo1", hozAlign:"center", headerHozAlign: "center", width:119, validator:["maxLength:100"], editor:"input"},
|
|
| 251 |
+ {title:"[*2*]", field:"addrInfo2", hozAlign:"center", headerHozAlign: "center", width:119, validator:["maxLength:100"], editor:"input"},
|
|
| 252 |
+ {title:"[*3*]", field:"addrInfo3", hozAlign:"center", headerHozAlign: "center", width:119, validator:["maxLength:100"], editor:"input"},
|
|
| 253 |
+ {title:"[*4*]", field:"addrInfo4", hozAlign:"center", headerHozAlign: "center", width:119, validator:["maxLength:100"], editor:"input"},
|
|
| 254 |
+ {title:"메모", field:"addrComment", hozAlign:"center", headerHozAlign: "center", width:119, validator:["maxLength:100"], editor:"input"}
|
|
| 255 |
+ ], |
|
| 256 |
+ navigation: true // 키보드 탐색 활성화 |
|
| 257 |
+ }); |
|
| 258 |
+} |
|
| 259 |
+ |
|
| 260 |
+ |
|
| 261 |
+ |
|
| 262 |
+ |
|
| 263 |
+ |
|
| 264 |
+ |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?