{
 "hidden": false,
 "children": [{
  "configs": {"itemId": "module"},
  "expanded": true,
  "children": [{
   "configs": {
    "layout": "fit",
    "itemId": "viewport1"
   },
   "expanded": true,
   "children": [{
    "configs": {
     "tagConfigs": "{\
  //如果表格存在此方法，二进制字段自动生成下载链接并指向此方法，如果存在多个二进制字段可通过ifDownloadBlob方法控制哪个字段提供下载\
  downloadBlob: function(fieldName, rowIndex) {\
    var grid = this;\
    //在文件列表中按ctrl+双击文件名可添加url地址\
    Wb.download('m?xwl=examples/crud/crud-db-access/download-blob', {\
      ID_FIELD: grid.store.getAt(rowIndex).data.ID_FIELD\
    });\
  },\
  /*ifDownloadBlob:function(fieldName){\
     return fieldName=='foo';//只允许foo字段下载\
  }其他还有方法ifUploadBlob，ifRemoveBlob控制是否提供该项功能*/\
  uploadBlob: function(fieldName, rowIndex) {\
    var grid = this,\
      rec = grid.store.getAt(rowIndex);\
    if (rec.dirty) {\
      Wb.warn('请保存该记录然后再试一次。');\
      return;\
    }\
    Wb.run({\
      url: 'upload', //调用upload公用对话框，无需权限。\
      success: function(app) {\
        app.upload({\
          url: 'm?xwl=examples/crud/crud-db-access/upload-blob',\
          title: '上传二进制字段',\
          params: rec.data, //整条记录所有字段都作为参数\
          success: function() {\
            rec.set(fieldName, 'blob'); //表示有二进制内容\
            rec.commit();\
          }\
        });\
      }\
    });\
  },\
  removeBlob: function(fieldName, rowIndex) {\
    var grid = this,\
      rec = grid.store.getAt(rowIndex);\
    if (rec.dirty) {\
      Wb.warn('请保存该记录然后再试一次。');\
      return;\
    }\
    Wb.confirm('确定要删除该记录字段 \u201c' + Wb.getColumn(grid, fieldName).text + '\u201d 的内容吗？', function() {\
      Wb.request({\
        url: 'm?xwl=examples/crud/crud-db-access/remove-blob',\
        params: rec.data,\
        success: function(resp) {\
          rec.set(fieldName, ''); //表示无二进制内容\
          rec.commit();\
        }\
      });\
    });\
  }\
}",
     "itemId": "grid1",
     "editable": "true",
     "multiSelect": "true"
    },
    "expanded": true,
    "children": [
     {
      "configs": {
       "itemId": "store",
       "autoLoad": "true",
       "url": "m?xwl=examples/crud/crud-db-access/select"
      },
      "expanded": false,
      "children": [],
      "type": "store"
     },
     {
      "configs": {"itemId": "tbar"},
      "expanded": true,
      "children": [
       {
        "configs": {
         "itemId": "newBtn",
         "tooltip": "添加新的记录",
         "text": "添加",
         "iconCls": "record_add_icon"
        },
        "expanded": false,
        "children": [],
        "type": "item",
        "events": {"click": "Wb.addEdit(app.grid1); //更多选项可使用Wb.add方法"}
       },
       {
        "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": "保存所有的更改",
         "text": "保存",
         "iconCls": "save_icon"
        },
        "expanded": false,
        "children": [],
        "type": "item",
        "events": {"click": "if (!Wb.verifyGrid(app.grid1)) //验证数据是否合法\
  return;\
Wb.sync({\
  grid: app.grid1,\
  url: 'm?xwl=examples/crud/crud-db-access/save',\
  message: '正在保存中...',\
  success: function(resp) {\
    //ID_FIELD值在后台生成，把返回的ID_FIELD值列表同步到表格中\
    Wb.syncCreate(app.grid1, Wb.decode(resp.responseText));\
  }\
});"}
       }
      ],
      "type": "toolbar"
     }
    ],
    "type": "grid"
   }],
   "type": "viewport"
  }],
  "type": "module"
 }],
 "roles": {"demo": 1},
 "title": "字典可编辑表格",
 "iconCls": "",
 "inframe": false,
 "pageLink": ""
}