参考案例:/UI2/demo/acc_data/list.w
data组件接管onCustomRefresh事件,就是自己接管数据的刷新
Model.prototype.accountDataCustomRefresh = function(event){ var data = event.source; Baas.sendRequest({ "url" : "/justep/account", "action" : "queryAccount", "params" : { "columns" : Baas.getDataColumns(data), "limit" : event.limit, "offset" : event.offset }, "success" : function(resultData) { var append = event.options && event.options.append; data.loadData(resultData, append); } }); };
data组件接管onCustomSave事件,就是自己接管数据的保存
Model.prototype.accountDataCustomSave = function(event){ var data = event.source; var data2 = data.toJson({onlyChanged:true,excludeCalculateCol:true}); data2.userdata["tableName"] = 'account'; //写入表名 var saveParam = {}; saveParam.tables = []; saveParam.tables.push(data2); Baas.sendRequest({ "url" : "/justep/account", "action" : "saveAccount", "params" : saveParam }); };
评一波