1. #1
    Sencha User
    Join Date
    Jan 2008
    Posts
    3
    Vote Rating
    0
    cole_yang is on a distinguished road

      0  

    Default Ext.Direct too bugs

    Ext.Direct too bugs


    I try Ext.Direct,but find has too bugs.

    1.
    Code:
      Ext.Direct.removeProvider = function(id) {
    	//bug forget use this.provider
    	var provider = id.id ? id : this.providers[id];
    	if (provider) {
    		provider.un('data', this.onProviderData, this);
    		provider.un('exception', this.onProviderException, this);
    		delete this.providers[provider.id];
    		provider.disconnect();
    	}
    
    	return provider;
    };
    2. Ext.direct.RemotingProvider
    when form fail,retry use doSend not doForm?
    when call fail,can't retry

    I fix these problemes:
    Code:
    queueTransaction : function(t) {
    		//bug for support retry form fail
    		if (t.form) {
    			Ext.Ajax.request(t.form);
    			return;
    		}
    		
    		this.callBuffer.push(t);
    		if (this.enableBuffer) {
    			if (!this.callTask) {
    				this.callTask = new Ext.util.DelayedTask(this.combineAndSend,
    						this);
    			}
    			this.callTask.delay(typeof this.enableBuffer == 'number'
    					? this.enableBuffer
    					: 10);
    		} else {
    			this.combineAndSend();
    		}
    	}
    
    doForm : function(c, m, form, callback, scope) {
    		var t = new Ext.Direct.Transaction({
    					provider : this,
    					action : c,
    					method : m.name,
    					args : [form, callback, scope],
    					cb : scope && typeof callback == 'function' ? callback
    							.createDelegate(scope) : callback
    				});
    
    		if (this.fireEvent('beforecall', this, t) !== false) {
    			Ext.Direct.addTransaction(t);
    
    			form = Ext.getDom(form);
    			var isUpload = String(form.getAttribute("enctype")).toLowerCase() == 'multipart/form-data';
    
    			var params = {
    				extTID : t.tid,
    				extAction : c,
    				extMethod : m.name,
    				extUpload : String(isUpload)
    			};
    			if (callback && typeof callback == 'object') {
    				Ext.apply(params, callback.params);
    			}
    
    			t.form = {
    				url : this.url,
    				params : params,
    				callback : this.onData,
    				scope : this,
    				form : form, //bug add this property,for support retry
    				isUpload : isUpload,
    				ts : t
    			};
    			Ext.Ajax.request(t.form);
    		}
    	}
    
    
    
    
    doSend : function(data) {
    //bug add ts,for form and call the same,support retry
    		var ts = [];
    		var o = {
    			url : this.url,
    			callback : this.onData,
    			scope : this,
    			ts : ts
    		};
    
    		// send only needed data
    		var callData;
    		if (Ext.isArray(data)) {
    			callData = [];
    			for (var i = 0, len = data.length; i < len; i++) {
    				var d = this.getCallData(data[i]);
    				callData.push(d);
    				//bug add these
    				ts[i] = {
    					tid : d.tid
    				};
    
    			}
    		} else {
    			callData = this.getCallData(data);
    			ts[0]={tid : callData.tid};
    		}
    
    		if (this.enableUrlEncode) {
    			var params = {};
    			params[typeof this.enableUrlEncode == 'string'
    					? this.enableUrlEncode
    					: 'data'] = Ext.encode(callData);
    			o.params = params;
    		} else {
    			o.jsonData = callData;
    		}
    		Ext.Ajax.request(o);
    	}
    Last edited by evant; 26 May 2009 at 5:52 PM. Reason: Please put code in [code][/code] tags.

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar