diff options
| author | rojaro <> | 2009-11-01 21:06:03 +0000 | 
|---|---|---|
| committer | rojaro <> | 2009-11-01 21:06:03 +0000 | 
| commit | b904a24660f4a4dc5ad73a1cbb9ca6b80314f694 (patch) | |
| tree | 44ea83ce741ef4729465ee5e4625b36218f69ca0 | |
| parent | 0c3d50c302422a9d735e8532bddb1ba588bf9d2f (diff) | |
merged fix for asynchronous callback requests from http://www.pradosoft.com/forum/index.php?topic=12179.0
| -rw-r--r-- | framework/Web/Javascripts/source/prado/activecontrols/ajax3.js | 23 | 
1 files changed, 20 insertions, 3 deletions
diff --git a/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js b/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js index 331a1f79..cf7ae7a2 100644 --- a/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js +++ b/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js @@ -471,9 +471,10 @@ Prado.CallbackRequest.prototype = Object.extend(Prado.AjaxRequest.prototype,  		this.transport = Ajax.getTransport();
  		this.Enabled = true;
  		this.id = id;
 +		this.randomId = this.randomString();
  		if(typeof(id)=="string"){
 -			Prado.CallbackRequest.requests[id] = this;
 +			Prado.CallbackRequest.requests[id+"__"+this.randomId] = this;
  		}
  		this.setOptions(Object.extend(
 @@ -487,6 +488,7 @@ Prado.CallbackRequest.prototype = Object.extend(Prado.AjaxRequest.prototype,  		}, options || {}));
  		this.ActiveControl = this.options;
 +		Prado.CallbackRequest.requests[id+"__"+this.randomId].ActiveControl = this.options;
  	},
  	/**
 @@ -528,7 +530,9 @@ Prado.CallbackRequest.prototype = Object.extend(Prado.AjaxRequest.prototype,  	 */
  	setCallbackParameter : function(value)
  	{
 +		var requestId = this.id+"__"+this.randomId;
  		this.ActiveControl['CallbackParameter'] = value;
 +		Prado.CallbackRequest.requests[requestId].ActiveControl['CallbackParameter'] = value;
  	},
  	/**
 @@ -536,7 +540,7 @@ Prado.CallbackRequest.prototype = Object.extend(Prado.AjaxRequest.prototype,  	 */
  	getCallbackParameter : function()
  	{
 -		return this.ActiveControl['CallbackParameter'];
 +		return Prado.CallbackRequest.requests[this.id+"__"+this.randomId].ActiveControl['CallbackParameter'];
  	},
  	/**
 @@ -670,7 +674,7 @@ Prado.CallbackRequest.prototype = Object.extend(Prado.AjaxRequest.prototype,  			})
  		}
  		if(typeof(this.ActiveControl.CallbackParameter) != "undefined")
 -			data[callback.FIELD_CALLBACK_PARAMETER] = callback.encode(this.ActiveControl.CallbackParameter);
 +			data[callback.FIELD_CALLBACK_PARAMETER] = callback.encode(this.getCallbackParameter());
  		var pageState = $F(callback.FIELD_CALLBACK_PAGESTATE);
  		if(typeof(pageState) != "undefined")
  			data[callback.FIELD_CALLBACK_PAGESTATE] = pageState;
 @@ -680,6 +684,19 @@ Prado.CallbackRequest.prototype = Object.extend(Prado.AjaxRequest.prototype,  		if(this.ActiveControl.EventParameter)
  			data[callback.FIELD_POSTBACK_PARAMETER] = this.ActiveControl.EventParameter;
  		return $H(data).toQueryString();
 +	},
 +
 +	/**
 +	 * Creates a random string with a length of 8 chars.
 +	 * @return string
 +	 */
 +	randomString : function()
 +	{
 +		chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
 +		randomString = "";
 +		for(x=0;x<8;x++)
 +			randomString += chars.charAt(Math.floor(Math.random() * 62));
 +		return randomString
  	}
  });
  | 
