diff --git a/src/main/webapp/WEB-INF/views/web/input/sampleInfo.jsp b/src/main/webapp/WEB-INF/views/web/input/sampleInfo.jsp index e59bf943..be3837f0 100644 --- a/src/main/webapp/WEB-INF/views/web/input/sampleInfo.jsp +++ b/src/main/webapp/WEB-INF/views/web/input/sampleInfo.jsp @@ -711,6 +711,7 @@ function fn_grid_refresh(){ fn_isMsg(); fn_onLoad(); fn_MakeDataArray(); + fn_ConvertGridData(); // DB에서 값없음(-999); 화면에서 갑없음(-); kendo grid에서 값 없음(null) 처리 fn_kendoGrid(); fn_setGridCombo(); @@ -754,7 +755,20 @@ function fn_grid_refresh(){ }); /* 탭 & 엔터키 이동 끝 */ } + /** + * DB에서 값없음(-999); 화면에서 갑없음(-); kendo grid에서 값 없음(null) 처리 + */ + function fn_ConvertGridData() { + if (!Array.isArray(gridData)) return; + gridData.forEach(item => { + if (item.sampleGs == -999) item.sampleGs = null; + if (item.sampleWc == -999) item.sampleWc = null; + if (item.sampleLl == -999) item.sampleLl = null; + if (item.samplePi == -999) item.samplePi = null; + if (item.sampleRd == -999) item.sampleRd = null; + }); + } function fn_kendoGrid() { var nullTypeString = 'test'; @@ -801,12 +815,12 @@ function fn_grid_refresh(){ sampleDepthTo: { type: "number" }, sampleSamplingMethod: { type: "string" }, sampleShape: { type: "string" }, - sampleWc: { type: "number", defaultValue: "-"}, - sampleGs: { type: "number", defaultValue: "-"}, - sampleLl: { type: "number", defaultValue: "-" }, - samplePi: { type: "number", defaultValue: "-" }, + sampleWc: { type: "number", defaultValue: null}, + sampleGs: { type: "number", defaultValue: null}, + sampleLl: { type: "number", defaultValue: null }, + samplePi: { type: "number", defaultValue: null }, sampleDesc: { type: "string" }, - sampleRd: { type: "number", defaultValue: "-" }, + sampleRd: { type: "number", defaultValue: null }, sampleUscs: { type: "string" }, sampleCode: { type: "string", editable: false }, } diff --git a/src/main/webapp/kendo-ui/js/common.js b/src/main/webapp/kendo-ui/js/common.js index fcb53e2e..34962080 100644 --- a/src/main/webapp/kendo-ui/js/common.js +++ b/src/main/webapp/kendo-ui/js/common.js @@ -52,8 +52,12 @@ function numericEditor(container, options, isHyphenAllowed = false) { function numericEditor2(container, options, isHyphenAllowed = false) { - var input = kendoJQuery(''); - + let rawVal = options.model[options.field]; + if (rawVal === -999) { + options.model.set(options.field, null); + rawVal = null; + } + var input = kendoJQuery(''); input.appendTo(container) .val(options.model[options.field]) @@ -66,6 +70,12 @@ function numericEditor2(container, options, isHyphenAllowed = false) { this.value = val.slice(0, -1); } }) + .on("focus", function () { + if (this.value === "") { + this.value = "-"; + } + this.select(); + }) // 2. ↑ ↓ 키로 값 증가/감소 .on("keydown", function (e) {