DWRTreeLoader.js
资源名称:EXT_study.rar [点击查看]
上传用户:zaktkj
上传日期:2022-08-08
资源大小:5770k
文件大小:2k
源码类别:
JavaScript
开发平台:
JavaScript
- Ext.tree.DWRTreeLoader = function(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);
- 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") {
- // alert(callback);
- 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);
- }
- }
- });