一:在數據的添加時一般注意的方法
在主從表中的添加方法中,在datapilot中的onSubControlAction(self.arg)中的代碼是:
var code = arg.code;
switch(code){
case "+":
//得到主表的數據集對象
var dataSetDept = this.get("#主表dataSet的ID");
//得到主表的數據集
var currentDept = dataSetDept.getData(#);
//根據主表的數據集得到其中的那個reference對應的數據集
var currendtEmployees = currentDept.get("主表中reference的name的值");
//根據得到的數據集向其中插入一條對象,注意的是:這里的deptId不是數據庫中的字段,而是實體類的屬性
currentEmployees.insert({deptId:currentDept.get("id")});
//防止系統自動的添加一行
arg.processDefault = false;
break;
}
在單表中需要這樣的代碼時的寫法:(一般是在用對話框修改時用的這中方式)
var code = arg.code;
switch(code){
case "+":
//得到表的數據集
var dataSet = this.get("#dataSet的ID");
//出入一條空的記錄,所有的數據是在對話框中添加的
dataSet.insert({});
//控制系統自動添加
arg.processDefault = false;
//對話框的顯示,在對話框的按鈕上提交數據
var dialog = this.get("#dialog的ID");
dialog.show();
brek;
}
在取消按鈕上的方法一般這樣寫:
var dataSet = this.get("#ID");
//通過cancle函數可以取消從上次提交至今對數據的修改
dataSet.getData().cancle();
this.get("#對話框的ID").hide();
在確定按鈕上這樣寫,好些:
var updateAction = this.get("#updateAction");
updateAction.execute(function(){
this.get("#dialogID").hide();
});
${dorado.getDataProvider("baseClassPR#getCodes").getResult("CLIENTTYPE")}
${dorado.getDataProvider("baseClassPR#getCodes").getResult("SEDSETTYPE")}
二:在顯示數據時需要有條件查詢的數據顯示,包括了分頁
在點擊確定查詢的時候把數據過去
//得到autoForm的對象
var autoForm = this.get("#autoFormId");
//得到數據集對象
var dataSet = this.get("#dataSetID");
//得到autoForm中填寫的數據
var data = autoForm.get("entity");
//將數據作為參數傳過去
dataSet.set("parameter",data);
//刷新數據集
dataSet.flushAsync();
${dorado.getDataProvider("deptDao#getAllDept").getResult()}
在tree上節點的上的onDataRowClick()
var nodeUrl = self.get("currentNode").get("data");
var MainiFrame = this.id("MainiFrame");
MainiFrame.set("path", nodeUrl);
//在dataGrid中onRwnderCell()
arg.dom.innerHTML = "<a href='../Issure.d?id="+arg.data.get('id')+"'>"+ arg.data.get('id') + "</a>";
/////////////////////////////////////////////////////在點擊刪除的時候自定義
var updataAction = this.id("updateActionUserBsdn");
switch (code){
case "+" :
arg.processDefault = false;
currentReference.insert({ corp_id : currentDatapath.get("id") });
break;
case "-":
arg.processDefault = false;
dorado.MessageBox.confirm("是否刪除數據?",function(){
currentReference.remove();
updataAction.execute();
});
break;
}
//////////////////////在dorado中使用request得到代碼中的信息
var RerrorMsg = "${request.getAttribute('RerrorMsg')}";