testIBSheet7.jsp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <%@page import="com.udapsoft.waf.system.HandlerStorage"%>
  2. <%@ page contentType="text/html; charset=utf-8" %>
  3. <%@ include file="/jsp/work/taglib.jsp" %>
  4. <jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
  5. <%
  6. ctx.init(request, response);
  7. %>
  8. <script type="text/javascript">
  9. /**
  10. * Global variables
  11. */
  12. var masterSheet;
  13. var masterSheetRow;
  14. var masterSheetPageNo = 1;
  15. var pageLastRowIndex = 1;
  16. var validationResult = false;
  17. var filterShow = false;
  18. /**
  19. * Application Init Function
  20. * Template 으로 부터 자동으로 호출되는 함수
  21. */
  22. function _onReady(){
  23. /**
  24. * IBSheet object initialize
  25. */
  26. gridInit(masterSheet);
  27. /**
  28. * Application Initialize
  29. */
  30. jQuery("#btnSearch").click(function() {
  31. jQuery("#fevent").val("masterDataList");
  32. var url = Modular.model.PageContext.CONTEXT_ROOT + "/testIBSheet7MasterData.screen";
  33. Modular.view.IBSheet7.doSearch(masterSheet, url, jQuery("#searchForm"), 10000, "");
  34. });
  35. jQuery("#btnAdd").click(function() {
  36. var rowIdx = masterSheet.DataInsert(-1);
  37. });
  38. jQuery("#btnSave").click(function() {
  39. if (confirm("저장하시겠습니까?")) {
  40. jQuery("#fevent").val("masterDataCUD");
  41. var url = Modular.model.PageContext.CONTEXT_ROOT + "/testIBSheet7MasterData.screen";
  42. var result = Modular.view.IBSheet7.doSave(masterSheet, url, jQuery("#searchForm"), false);
  43. }
  44. });
  45. }
  46. /**
  47. * IBSheet object initialize
  48. */
  49. function gridInit(sheetName){
  50. var init_sheet = {};
  51. init_sheet.Cfg = {SearchMode:2, Page:10000};
  52. init_sheet.Cols = [
  53. {Header:'Status',Type:"Status", SaveName:"sStatus", Width:80, Align:"Center" ,Hidden:"True"},
  54. {Header:'Sequence',Type:"Seq", SaveName:"sSeq", Width:0, Align:"Center"},
  55. {Header:'Delete',Type:"DelCheck", SaveName:"delCheck", Width:80, Align:"Center"},
  56. {Header:'Primary ID',Type:"Int", SaveName:"pid", Width:100, Align:"Left" , UpdateEdit:0},
  57. {Header:'First name',Type:"Text", SaveName:"first_name", Width:120, Align:"Left"},
  58. {Header:'Last name',Type:"Text", SaveName:"last_name", Width:120, Align:"Left"},
  59. {Header:'Birth',Type:"Date", SaveName:"birth", Width:120, Align:"Left", Format:"Ymd"},
  60. {Header:'Gender',Type:"Combo", SaveName:"gender", Width:120, Align:"center", ComboText:"${MASTERSHEET_GENDER['TEXT']}", ComboCode:"${MASTERSHEET_GENDER['CODE']}"},
  61. {Header:'Salary',Type:"Float", SaveName:"salary", Width:180, Align:"right"}
  62. ];
  63. init_sheet.HeaderMode = {Sort:1};
  64. IBS_InitSheet(sheetName, init_sheet);
  65. sheetName.SetDataAutoTrim(0);
  66. setGridSize();
  67. }
  68. /**
  69. * IBSheet Event: Search End(IBSheet 데이터 조회 CallBack)
  70. */
  71. function masterSheet_OnSearchEnd(code, message) {
  72. if(code == 0) {
  73. setGridSize();
  74. } else {
  75. //조회 에러 수행
  76. alert(message);
  77. }
  78. }
  79. /**
  80. * IBSheet Event: Save End(IBSheet 데이터 저장 CallBack)
  81. */
  82. function masterSheet_OnSaveEnd(code, msg) {
  83. if(code >= 0) {
  84. alert("저장 성공");
  85. } else {
  86. alert(msg);
  87. }
  88. }
  89. /**
  90. * IBSheet Event: Click
  91. */
  92. function masterSheet_OnClick(Row, Col, Value, CellX, CellY, CellW, CellH) {
  93. masterSheetRow = Row;
  94. }
  95. /**
  96. * IBSheet size setting
  97. */
  98. function setGridSize() {
  99. masterSheet.FitColWidth();
  100. }
  101. </script>
  102. <modular:search id="searchForm">
  103. <modular:key id="fevent" />
  104. </modular:search>
  105. <form id="searchForm" method="post" modular:type="search">
  106. <input type="text" name="fevent" value="" />
  107. <div style="text-align:right;">
  108. <input type="button" id="btnSearch" value="Search" />
  109. <input type="button" id="btnAdd" value="Add" />
  110. <input type="button" id="btnSave" value="Save" />
  111. </div>
  112. <br>
  113. <!-- IBSheet7 그리드 생성 -->
  114. <script>createIBSheet('masterSheet','100%', '200px');</script>
  115. </form>