List页面相关代码
wiindowDialog打开窗口代码:快捷操作:dialogopen alt+/
this.comp(“detailDialog”).open({
“data” : {
“operator” : “new”
}
});
wiindowDialog编辑打开代码:快捷操作:dialogopen alt+/
var row = event.bindingContext.$object; //当前行快捷操作 listrow alt+/
this.comp(“detailDialog”).open({
“data” : {
“operator” : “edit”
“rowData” : row.toJson() //当前行
}
});
删除当前行
var data = this.comp(“accountData”);
var row = event.bindingContext.$object;
data.deleteData(row);
返回数据保存
Model.prototype.detailDialogReceived = function(event) {
// 对话框返回后保存数据
this.comp(“accountData”).saveData();
};
记一笔页面相关代码
//对话框接收参数后,新增或编辑
Model.prototype.windowReceiver1Receive = function(event) {
// 对话框接收参数后,新增或编辑
var accountData = this.comp(“accountData”);
accountData.clear(); //清空缓存
this.operator = event.data.operator;
if (this.operator == “new”) {
//使用newdata alt+/ 快捷方式
accountData.newData({
“defaultValues” : [ {
“fID” : justep.UUID.createUUID(),
“fCreateTime” : new Date(),
“fDate” : new Date(),
“fType” : “支出”
} ]
});
} else if (this.operator == “edit”) {
accountData.loadData([ event.data.rowData ]);
accountData.first();
}
};
新增或编辑后返回list 页面
// 确定后返回当前行,用于windowDialog的mapping映射
var accountData = this.comp(“accountData”);
this.owner.send(accountData.getCurrentRow());