유용 javascript 함수
// select option 추가
fnCreateSelectOptions: function(selectBoxName, optionData, selectedValue) {
var objSelectBox = document.getElementById(selectBoxName);
for (var i=0; i < optionData.length; i++) {
var eachOption = optionData[i];
var objOption = document.createElement("option");
objOption.text = eachOption.codeName;
objOption.value = eachOption.codeID;
if(eachOption.codeValue != null) {
objOption.label = eachOption.codeValue;
}
objSelectBox.options.add(objOption);
}
if(!COMMON.Utils.fnIsEmpty(selectedValue)) {
$("#" + selectBoxName + "").select2("val", selectedValue);
} else {
$("#" + selectBoxName + "").select2("val", "");
}
},
fnIsEmpty: function(str) {
if(str == null || str == undefined) {
return true;
} else if(typeof (str) == "string" && str.trim() == "") {
return true;
} else {
return false;
}
},
// 검색 조건에서 enter key 입력시 조회되도록
//사용법 : COMMON.Utils.fnEnterEvent($("#frmSearchPayment"), "fnSearchPayment");
fnEnterEvent: function(formObj, callBackFn, callBackParam) {
formObj.find(".form-enter").on("keydown", function(event) {
if(13 == event.which) {
if(typeof callBackParam != 'undefined' && null != callBackParam && "" != callBackParam) {
eval(callBackFn)(callBackParam);
} else {
eval(callBackFn)();
}
}
});
}