{"TYPE":"Single","MTX_MODULE_INFO":[{"MODULE_CODE":"MOD99EA14A1B54B2063EAFA00DCDCEF9A3F","MODULE_SUBJECT":"스마트에디터 활용 데이터 저장하기","USE_AUTHORITY":"0","EDIT_AUTHORITY":"-1","MODULE_DESCRIPTION":"DataGrid와 Add-In 컴포넌트를 활용하여 데이터를 저장합니다.\nAdd-In 컴포넌트 배치 후 Class 옵션을 SmartEditor로 변경합니다.\nSmartEditor를 활용하여 텍스트 데이터 저장 시 html 데이터로 저장됩니다. (DB 컬럼 유형 Text 추천)","SCRIPT_TEXT":"var dgName = Matrix.getObject(arguments[0]);\nvar fldName = arguments[1];\nvar ADDIN_CONTENTS = Matrix.getObject(arguments[2]);\nvar btnSave = Matrix.getObject(arguments[3]);\nvar planName = arguments[4];\n\nvar addinCeontents  = null;\nvar EDITOR_LOADING_MAX_TRY_COUNT = 10;\n\n/*****************************************\n* Addin 로딩 딜레이 해소를 위한 함수\n* * arguments :  \n*\t\t function\tcallback : OnLoad 함수\n*\t\t number\t\tmaxTryCount : 최대 시도 휫수 \n*****************************************/\n var AddinOnLoad = function(callback, maxTryCount){\n\tvar delayedSetValue = function(tryCount) {\n        tryCount++;\n\t\ttry{\n\t\t\tif (maxTryCount > tryCount) {\n\t\t\t\tcallback();\n\t\t\t}\n\t\t}catch(e){\n\t\t\twindow.setTimeout(delayedSetValue.bind(null, tryCount), 50);\n\t\t}\t\t\n    } \n\tdelayedSetValue(0);\t\n };\n\nAddinOnLoad( function(){\n\taddinCeontents = ADDIN_CONTENTS.getScriptClass(\"BIMatrix.SmartEditor.SmartEditor\");\t\n\taddinCeontents.SetValue('<p><span style=\"color: rgb(255, 0, 0);\">test</span></p><p>&nbsp;</p><p>&nbsp;</p>');\t\n}, EDITOR_LOADING_MAX_TRY_COUNT);\n\n\ndgName.OnDataBindEnd  = function(s, e){\n\tvar contents = dgName.GetRow(0).GetValue(fldName);\n\t\t\n\taddinCeontents.SetValue(contents);\n};\n\nbtnSave.OnClick  = function(sender, args){\n\t\t\n\tdgName.GetRow(0).SetValue(fldName ,addinCeontents.GetValue());\n\tdgName.EndUpdate();\n\tdgName.ChangeRowStateAt(0 ,'U');\n\n\tMatrix.ExecutePlan(planName ,\tnull ,function(p){\n\t\t\t\t\t\t\t\tif(p.Success == false){\n\t\t\t\t\t\t\t\t\tMatrix.Alert(p.Message);\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tMatrix.doRefresh(dgName);\n\t\t\t\t\t\t\t\talert(\"저장하였습니다.\");\n\t\t\t\t\t\t\t});\n};","MODULE_TYPE":"","RESULT_TYPE":"","ORIGINAL_MODULE_CODE":"","CREATE_USER":"matrix","MODIFY_USER":"matrix","MODULE_SEQ":"8","WF_YN":"","EVENT_YN":"N","ATTR1":"","ATTR2":"","ATTR3":"", "MTX_MODULE_PARAMS":[{"MODULE_CODE":"MOD99EA14A1B54B2063EAFA00DCDCEF9A3F","PARAM_SEQ":"1","PARAM_TYPE":"INP003","NULLABLE":"N","PARAM_DESCRIPTION":"데이터소스를 연결한 데이터그리드 선택","DEFAULT_VALUE":"","ATTR1":"","ATTR2":"","ATTR3":""},{"MODULE_CODE":"MOD99EA14A1B54B2063EAFA00DCDCEF9A3F","PARAM_SEQ":"2","PARAM_TYPE":"INP001","NULLABLE":"N","PARAM_DESCRIPTION":"스마트에디터와 연결할 필드명 입력","DEFAULT_VALUE":"","ATTR1":"","ATTR2":"","ATTR3":""},{"MODULE_CODE":"MOD99EA14A1B54B2063EAFA00DCDCEF9A3F","PARAM_SEQ":"3","PARAM_TYPE":"INP004","NULLABLE":"N","PARAM_DESCRIPTION":"스마트에디터 선택","DEFAULT_VALUE":"","ATTR1":"","ATTR2":"","ATTR3":""},{"MODULE_CODE":"MOD99EA14A1B54B2063EAFA00DCDCEF9A3F","PARAM_SEQ":"4","PARAM_TYPE":"INP004","NULLABLE":"N","PARAM_DESCRIPTION":"저장 버튼 선택","DEFAULT_VALUE":"","ATTR1":"","ATTR2":"","ATTR3":""},{"MODULE_CODE":"MOD99EA14A1B54B2063EAFA00DCDCEF9A3F","PARAM_SEQ":"5","PARAM_TYPE":"INP011","NULLABLE":"N","PARAM_DESCRIPTION":"실행계획 선택","DEFAULT_VALUE":"","ATTR1":"","ATTR2":"","ATTR3":""}]}]}