From b904a24660f4a4dc5ad73a1cbb9ca6b80314f694 Mon Sep 17 00:00:00 2001 From: rojaro <> Date: Sun, 1 Nov 2009 21:06:03 +0000 Subject: merged fix for asynchronous callback requests from http://www.pradosoft.com/forum/index.php?topic=12179.0 --- .../source/prado/activecontrols/ajax3.js | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'framework') 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 } }); -- cgit v1.2.3