레이아웃 저장시 numeric칼럼 숫자만 입력하도록 validation & focus 이동
eapim-admin CI / build (push) Has been cancelled

This commit is contained in:
eastargh
2026-07-31 13:58:32 +09:00
parent fc6b96d7cd
commit 8215b596fe
@@ -76,13 +76,13 @@
columns = [ // for columnData prop
{ title: '<%= localeMessage.getString("layoutMan.itemDesc") %>', name: 'loutItemDesc', type: 'text', width:280, resize:true, minWidth:120 },
{ title: '<%= localeMessage.getString("layoutMan.itmeEn") %>', name: 'loutItemName', type: 'text', width:280, resize:true, minWidth:120 },
{ title: '<%=localeMessage.getString("standardLayout.itemLevel")%>', name: 'loutItemDepth', type: 'text', width:50 },
{ title: '<%=localeMessage.getString("standardLayout.itemLevel")%>', name: 'loutItemDepth', type: 'numeric', width:50 },
{ title: '<%= localeMessage.getString("standardLayout.itemType") %>', name: 'loutItemType', type: 'autocomplete', source: itemTypes, width:70 },
{ title: '<%= localeMessage.getString("standardLayout.arraySize") %>', name: 'loutItemOccCnt', type: 'text', width:90 },
{ title: '<%= localeMessage.getString("standardLayout.refField") %>', name: 'loutItemOccRef', type: 'text', width:90 },
{ title: '<%=localeMessage.getString("layoutMan.dataType")%>', name: 'loutItemDataType', type: 'autocomplete', source: basicDataTypes, width:160 },
{ title: '<%=localeMessage.getString("layoutMan.dataLen")%>', name: 'loutItemLength', type: 'numeric', width: 70, align: 'center' },
{ title: '<%=localeMessage.getString("layoutMan.decpLen")%>', name: 'loutItemDecimal', type: 'text', width: 70 },
{ title: '<%=localeMessage.getString("layoutMan.decpLen")%>', name: 'loutItemDecimal', type: 'numeric', width: 70 },
{ title: '<%=localeMessage.getString("layoutMan.defaultVal")%>', name: 'loutItemDefault', type: 'text', width: 70 },
{ title: '<%=localeMessage.getString("layoutMan.mask")%>', name: 'loutItemMaskYn', type: 'checkbox', width: 70 },
{ title: '<%=localeMessage.getString("layoutMan.moffset")%>', name: 'loutItemMaskOffset', type: 'text', width: 50 },
@@ -182,6 +182,41 @@
$('#dataTotalLen').text(totalLen);
}
function focusGridCell(colIndex, rowIndex) {
var cellName = jexcel.getColumnNameFromId([colIndex, rowIndex]);
var cell = grid.getCell(cellName);
grid.updateSelection(cell);
cell.scrollIntoView({block: 'center', inline: 'center'});
grid.openEditor(cell, false);
}
var INTEGER_REGEXP = /^(0|[1-9][0-9]*)$/;
function validateNumberColumns() {
var data = grid.getData();
var gridColumns = grid.options.columns;
for (var col = 0; col < gridColumns.length; col++) {
if (gridColumns[col].type !== 'numeric') {
continue;
}
for (var row = 0; row < data.length; row++) {
var value = data[row][col];
if (value == null) {
continue;
}
value = $.trim(String(value));
if (value !== '' && !INTEGER_REGEXP.test(value)) {
alert("숫자만 입력할 수 있습니다.");
focusGridCell(col, row);
return false;
}
}
}
return true;
}
function detail(key) {
if (!isDetail) {
return
@@ -321,6 +356,10 @@
});
$("#btn_modify").click(function(){
if (!validateNumberColumns()) {
return;
}
var postData = $('#ajaxForm').serializeArray();
if (isDetail){
postData.push({ name: "cmd" , value:"UPDATE"});