{"TYPE":"Single","MTX_MODULE_INFO":[{"MODULE_CODE":"MODFD7CFF5793EE99ED4992BF9E4A7F023B","MODULE_SUBJECT":"데이터 그리드 CRUD 템플릿(수정)","USE_AUTHORITY":"0","EDIT_AUTHORITY":"-1","MODULE_DESCRIPTION":"데이터 그리드와 버튼을 이용하여 CRUD 보고서 개발에 대한 템플릿을 생성합니다.\n저장 동작은 실행 계획 호출을 통해 수행 합니다.","SCRIPT_TEXT":"/*\n경고! 이 모듈은 시스템 모듈로 시스템 업데이트 시 초기화 될 수 있으니 직접 수정하지 마십시요\nwarning! This module is a system module and may be initialized when the system is updated, so do not modify it directly.\n\n데이터 그리드  CRUD 템플릿\n*/\n\n\t\tvar GRID = Matrix.getObject(arguments[0]);\n\t\tvar btnNew = Matrix.getObject(arguments[1]);\n\t\tvar btnDelete = Matrix.getObject(arguments[2]);\n\t\tvar btnSave   = Matrix.getObject(arguments[3]);\n\t\tvar btnQuery  = Matrix.getObject(arguments[4]);\n\t\tvar planName   = arguments[5];\n\t\tvar refreshCtl = arguments[6];\n\t\t\n\t\tif(!GRID){\n\t\t\treturn \"Control [\"+arguments[0]+\"] not found.\"; \n\t\t}\n\t\tif(!planName){\n\t\t\treturn \"ExecutePlan [\"+arguments[0]+\"] not found.\"; \n\t\t}\n\t\t\n\t\tGRID.Editable = true; // 그리드 수정 모드\n\t\t\n\t\tvar SaveData = function(){\n\t\t\tvar msg   = \"\";\n\t\t\tvar title = Matrix.getLanguage(\"TLE001\", \"저장확인\");\n\t\t\tif(GRID.IsModified() == false){\n\t\t\t\tmsg = Matrix.getLanguage(\"MSG004\", \"수정 내역이 없습니다.\");\n\t\t\t\tMatrix.Information(msg ,title);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(GRID.Validate() == false){\n\t\t\t\tmsg = Matrix.getLanguage(\"MSG005\", \"입력 필수 항목을 확인 바랍니다.\");\n\t\t\t\tMatrix.Information(msg ,title);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t//실행 계획 처리\n\t\t\tMatrix.ExecutePlan(planName ,\"\" ,function(p){\n\t\t\t\t\t\t\t\t\tif(p.Success == false){\n\t\t\t\t\t\t\t\t\t\tMatrix.Error(Matrix.getLanguage(\"MSG003\", \"처리 중 오류가 발생하였습니다.\"),p.Message);\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tGRID.ClearRowState();\n                                    if(refreshCtl){\n                                          Matrix.doRefresh(refreshCtl);\n                                    }\n\t\t\t\t\t\t\t\t});\n\t\t}\n\t\t\n\t\tif(btnNew){\n\t\t\t//신규 레코드 추가\n\t\t\tbtnNew.OnClick = function(s,e){\n\t\t\t\tGRID.AppendRow();\n\t\t\t};\n\t\t}\n\t\tif(btnDelete){ \t\n\t\t\t//선택된 레코드 삭제\n\t\t\tbtnDelete.OnClick = function(s,e){\n\t\t\t\t\tvar title = Matrix.getLanguage(\"TLE002\", \"삭제확인\");\n\t\t\t\t\tif(GRID.GetSelectedRows().length == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tMatrix.Information(Matrix.getLanguage(\"MSG_SEL_OBJ\", \"삭제할 항목을 선택해 주세요.\"),title);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\t\t\t\n\t\t\t\t\tvar msg = Matrix.getLanguage(\"MSG002\", \"선택하신 레코드를 삭제하시겠습니까?\");\n\t\t\t\t\tMatrix.Confirm(msg , title, function(isOk){\n\t\t\t\t\t\t\t\t\t\t\t\t\tif(isOk){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGRID.RemoveRow();\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t};\n\t\t}\n\t\tif(btnQuery){ \t\n\t\t\t//데이터 조회\n\t\t\tbtnQuery.OnClick = function(s,e){\n\t\t\t\t\t\n\t\t\t\tif(GRID.IsModified()){\t\t\t\n\t\t\t\t\tvar title = Matrix.getLanguage(\"TLE001\", \"저장확인\");\n\t\t\t\t\tvar msg = Matrix.getLanguage(\"MSG001\", \"수정된 내용이 있습니다. 해당 내용을 저장하시겠습니까?\");\n\t\t\t\t\tMatrix.Confirm(msg, title , function(isOk){\n\t\t\t\t\t\t\t\t\t\t\t\t\tif(isOk){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tSaveData();\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGRID.ClearRowState();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tMatrix.doRefresh(GRID.Name);\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}); \n\t\t\t\t}else{\n\t\t\t\t\tMatrix.doRefresh(GRID.Name);\n\t\t\t\t}\t\t\n\t\t\t};\n\t\t}\n\t\tif(btnSave){\n\t\t\t// 데이터 저장 \n\t\t\tbtnSave.OnClick = function(s,e){\t\t \n\t\t\t\tSaveData();\n\t\t\t}; //end btnSave.OnClick\n\t\t}","MODULE_TYPE":"","RESULT_TYPE":"","ORIGINAL_MODULE_CODE":"AUD_025","CREATE_USER":"edumaster","MODIFY_USER":"edumaster","MODULE_SEQ":"8","WF_YN":"Y","EVENT_YN":"N","ATTR1":"","ATTR2":"","ATTR3":"", "MTX_MODULE_PARAMS":[{"MODULE_CODE":"MODFD7CFF5793EE99ED4992BF9E4A7F023B","PARAM_SEQ":"1","PARAM_TYPE":"INP003","NULLABLE":"N","PARAM_DESCRIPTION":"데이터 그리드","DEFAULT_VALUE":"","ATTR1":"","ATTR2":"","ATTR3":""},{"MODULE_CODE":"MODFD7CFF5793EE99ED4992BF9E4A7F023B","PARAM_SEQ":"2","PARAM_TYPE":"INP004","NULLABLE":"Y","PARAM_DESCRIPTION":"신규 버튼","DEFAULT_VALUE":"","ATTR1":"","ATTR2":"","ATTR3":""},{"MODULE_CODE":"MODFD7CFF5793EE99ED4992BF9E4A7F023B","PARAM_SEQ":"3","PARAM_TYPE":"INP004","NULLABLE":"Y","PARAM_DESCRIPTION":"삭제 버튼","DEFAULT_VALUE":"","ATTR1":"","ATTR2":"","ATTR3":""},{"MODULE_CODE":"MODFD7CFF5793EE99ED4992BF9E4A7F023B","PARAM_SEQ":"4","PARAM_TYPE":"INP004","NULLABLE":"N","PARAM_DESCRIPTION":"저장 버튼","DEFAULT_VALUE":"","ATTR1":"","ATTR2":"","ATTR3":""},{"MODULE_CODE":"MODFD7CFF5793EE99ED4992BF9E4A7F023B","PARAM_SEQ":"5","PARAM_TYPE":"INP004","NULLABLE":"Y","PARAM_DESCRIPTION":"조회 버튼","DEFAULT_VALUE":"","ATTR1":"","ATTR2":"","ATTR3":""},{"MODULE_CODE":"MODFD7CFF5793EE99ED4992BF9E4A7F023B","PARAM_SEQ":"6","PARAM_TYPE":"INP001","NULLABLE":"N","PARAM_DESCRIPTION":"실행계획","DEFAULT_VALUE":"","ATTR1":"","ATTR2":"","ATTR3":""},{"MODULE_CODE":"MODFD7CFF5793EE99ED4992BF9E4A7F023B","PARAM_SEQ":"7","PARAM_TYPE":"INP005","NULLABLE":"Y","PARAM_DESCRIPTION":"데이터 저장 이후 조회할 컨트롤","DEFAULT_VALUE":"","ATTR1":"","ATTR2":"","ATTR3":""}]}]}