Ext.tree.DWRTreeLoader

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);
  }
 }

});

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值