{
 "hidden": false,
 "children": [{
  "configs": {"itemId": "module"},
  "expanded": true,
  "children": [{
   "configs": {
    "layout": "border",
    "itemId": "viewport1"
   },
   "expanded": true,
   "children": [{
    "configs": {
     "itemId": "toolbar1",
     "region": "north"
    },
    "expanded": true,
    "children": [
     {
      "configs": {
       "itemId": "newBtn",
       "tooltip": "添加新的记录 (Ctrl+E)",
       "text": "添加",
       "iconCls": "record_add_icon"
      },
      "expanded": false,
      "children": [],
      "type": "item",
      "events": {"click": "if (!app.selDept) {\
  Wb.warn('部门未选择。');\
  return;\
}\
Wb.addEdit(app.grid1, {\
  DEPT_ID: app.selDept.data.DEPT_ID\
});"}
     },
     {
      "configs": {
       "itemId": "delBtn",
       "tooltip": "删除选择的记录",
       "text": "删除",
       "iconCls": "record_delete_icon"
      },
      "expanded": false,
      "children": [],
      "type": "item",
      "events": {"click": "Wb.remove(app.grid1);"}
     },
     {
      "configs": {
       "itemId": "item1",
       "text": "-"
      },
      "expanded": false,
      "children": [],
      "type": "item"
     },
     {
      "configs": {
       "itemId": "saveBtn",
       "tooltip": "保存所有的更改 (Ctrl+S)",
       "text": "保存",
       "iconCls": "save_icon"
      },
      "expanded": false,
      "children": [],
      "type": "item",
      "events": {"click": "/**\
 * @author shaofq\
 * @since 2020-08-25\
 * @desc  框架测试类，获取热加载框架的实体，并执行实体的业务操作\
 */\
Wb.requestAg({\
  params: {\
    ids: ids,\
    type: \"2\",\
    bean: \"vbillFeeBService\",\
    method: \"payerCheck\"\
  },\
  success: function(resp) {\
    Wb.tip(\"取消确认成功！\");\
\
  }\
});"}
     },
     {
      "configs": {
       "itemId": "rejectBtn",
       "tooltip": "放弃自上次保存以来所有的更改",
       "text": "放弃",
       "iconCls": "table_delete_icon"
      },
      "expanded": false,
      "children": [],
      "type": "item",
      "events": {"click": "Wb.confirm('确定要放弃对表格的所有更改吗？', function() {\
  app.grid1.store.rejectChanges();\
  app.unModified();\
});"}
     },
     {
      "configs": {
       "itemId": "item2",
       "text": "-"
      },
      "expanded": false,
      "children": [],
      "type": "item"
     },
     {
      "configs": {
       "itemId": "combo1",
       "keyName": "CLIENT_TYPE"
      },
      "expanded": false,
      "children": [],
      "type": "combo"
     }
    ],
    "type": "toolbar"
   }],
   "type": "viewport",
   "events": {"afterrender": "app.afterRender();"}
  }],
  "type": "module",
  "events": {
   "beforeunload": "if (app.isModified)\
  return '可编辑表格示例数据已经被更改';",
   "initialize": "Wb.apply(app, {\
  /**\
   * tree1配置拖放事件，允许grid数据拖动到tree以调整人员所属部门。\
   */\
  treeViewConfig: {\
    plugins: {\
      ptype: 'treeviewdragdrop',\
      ddGroup: 'dept',\
      enableDrag: false\
    },\
    listeners: {\
      beforedrop: function(node, data, om, dp, dh) {\
        dh.wait = true;\
        dh.cancelDrop();\
        Wb.request({\
          url: 'm?xwl=examples/employee/edit/change-dept',\
          params: {\
            newDeptId: om.data.DEPT_ID,\
            recs: Wb.getData(data.records)\
          },\
          success: function() {\
            //停止删除store记录时触发的app.setModified方法\
            app.suspendSetModified = true;\
            Wb.remove(app.grid1);\
            app.suspendSetModified = false;\
          }\
        });\
      },\
      nodedragover: function(node, dp, data) {\
        return dp == 'append' && app.selectDeptNode != node;\
      }\
    }\
  },\
  /**\
   * 加载指定部门的人员数据。\
   */\
  loadData: function() {\
    if (app.selDept)\
      app.grid1.store.load({\
        params: app.selDept.data\
      });\
  },\
  /**\
   * 在Viewport1渲染完成后执行的方法。\
   */\
  afterRender: function() {\
    app.navKey = new Ext.KeyNav({\
      viewport: app.viewport1,\
      E: {\
        ctrl: true,\
        fn: function() {\
          app.newBtn.fireEvent('click');\
        }\
      },\
      S: {\
        ctrl: true,\
        fn: function() {\
          app.saveBtn.fireEvent('click');\
        }\
      }\
    });\
    app.unModified();\
  },\
  /**\
   * 设置为数据已经修改的状态。\
   */\
  setModified: function() {\
    if (app.suspendSetModified)\
      return;\
    app.isModified = true;\
    Wb.setDisabled([app.searchCombo, app.resetSearchBtn, app.deptTree.tree1, app.grid1.down('toolbar')], true);\
    Wb.setDisabled([app.saveBtn, app.rejectBtn], false);\
  },\
  /**\
   * 设置为数据未修改状态。\
   */\
  unModified: function() {\
    app.isModified = false;\
    Wb.setDisabled([app.searchCombo, app.resetSearchBtn, app.deptTree.tree1, app.grid1.down('toolbar')], false);\
    Wb.setDisabled([app.saveBtn, app.rejectBtn], true);\
  }\
});"
  }
 }],
 "roles": {"demo": 1},
 "title": "可编辑表格",
 "iconCls": "",
 "inframe": false,
 "pageLink": ""
}