dorado7 基礎資料操作的方法

來源:互聯網
上載者:User

 

一:在資料的添加時一般注意的方法
在主從表中的添加方法中,在datapilot中的onSubControlAction(self.arg)中的代碼是:

   var code = arg.code;
  
   switch(code){
     case "+":
     //得到主表的資料集對象
     var dataSetDept = this.get("#主表dataSetde的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')}";

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.