dorado7 基础数据操作的方法

一:在数据的添加时一般注意的方法
在主从表中的添加方法中,在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')}";

posted on 2015-02-27 10:21  牛志光  阅读(4241)  评论(0编辑  收藏  举报