Ext.tree.DWRTreeLoader

來源:互聯網
上載者:User

Ext.tree.DWRTreeLoader = function(config) {
//    Ext.apply(this,config);
 Ext.tree.DWRTreeLoader.superclass.constructor.call(this, config);
};

Ext.extend(Ext.tree.DWRTreeLoader, Ext.tree.TreeLoader, {
 requestData : function(node, callback) {
  if (this.fireEvent("beforeload", this, node, callback) !== false) {

   // todo
   // var params = this.getParams(node);

   var callParams = new Array();
   var success = this.handleResponse.createDelegate(this, [node,
     callback], 1);
   var error = this.handleFailure.createDelegate(this,
     [node, callback], 1);
   callParams.push(node.id);
   if (typeof this.baseParams == 'object') {
    for (var p in this.baseParams) {
     callParams.push(this.baseParams[p]);
    }
   }
   callParams.push({
    callback : success,
    errorHandler : error
   });

   // todo: do we need to set this to something else?
   this.transId = true;
   this.dataUrl.apply(this, callParams);
  } else {
   // if the load is cancelled, make sure we notify
   // the node that we are done
   if (typeof callback == "function") {
    callback();
   }
  }
 },

 processResponse : function(response, node, callback) {
  try {
   for (var i = 0; i < response.length; i++) {
    var n = this.createNode(response[i]);
    if (n) {
     node.appendChild(n);
    }
   }
   if (typeof callback == "function") {
    callback(this, node);
   }
  } catch (e) {
   this.handleFailure(response);
  }
 },

 handleResponse : function(response, node, callback) {
  this.transId = false;
  this.processResponse(response, node, callback);
  this.fireEvent("load", this, node, response);
 },

 handleFailure : function(response, node, callback) {
  this.transId = false;
  this.fireEvent("loadexception", this, node, response);
  if (typeof callback == "function") {
   callback(this, node);
  }
 }

});

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.