summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--framework/Web/Javascripts/source/prado/activecontrols/ajax3.js53
-rw-r--r--jQuery-WIP.txt2
2 files changed, 52 insertions, 3 deletions
diff --git a/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js b/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js
index 597187bb..e6616176 100644
--- a/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js
+++ b/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js
@@ -66,6 +66,55 @@ Prado.CallbackRequestManager =
}
msg += e.version+" "+e.time+"\n";
return msg;
+ },
+
+ /*! jQuery Ajax Queue - v0.1.2pre - 2013-03-19
+ * https://github.com/gnarf37/jquery-ajaxQueue
+ * Copyright (c) 2013 Corey Frang; Licensed MIT
+ * Slightly adapted for use within prado by Fabio Bas <ctrlaltca@gmail.com>
+ */
+
+ // jQuery on an empty object, we are going to use this as our Queue
+ ajaxQueue : jQuery({}),
+
+ ajax : function( ajaxOpts ) {
+ var jqXHR,
+ dfd = jQuery.Deferred(),
+ promise = dfd.promise();
+
+ // run the actual query
+ function doRequest( next ) {
+ jqXHR = jQuery.ajax( ajaxOpts );
+ jqXHR.done( dfd.resolve )
+ .fail( dfd.reject )
+ .then( next, next );
+ }
+
+ // queue our ajax request
+ Prado.CallbackRequestManager.ajaxQueue.queue( doRequest );
+
+ // add the abort method
+ promise.abort = function( statusText ) {
+
+ // proxy abort to the jqXHR if it is active
+ if ( jqXHR ) {
+ return jqXHR.abort( statusText );
+ }
+
+ // if there wasn't already a jqXHR we need to remove from queue
+ var queue = Prado.CallbackRequestManager.ajaxQueue.queue(),
+ index = jQuery.inArray( doRequest, queue );
+
+ if ( index > -1 ) {
+ queue.splice( index, 1 );
+ }
+
+ // and then reject the deferred
+ dfd.rejectWith( ajaxOpts.context || ajaxOpts, [ promise, statusText, "" ] );
+ return promise;
+ };
+
+ return promise;
}
};
@@ -215,7 +264,7 @@ Prado.CallbackRequest = jQuery.klass(Prado.PostBack,
this.options.data = this.getParameters();
this.options.url = this.getCallbackUrl();
- this.request = jQuery.ajax(this.options);
+ this.request = Prado.CallbackRequestManager.ajax(this.options);
},
abort : function()
@@ -239,7 +288,7 @@ Prado.CallbackRequest = jQuery.klass(Prado.PostBack,
if(this.options.EventTarget)
data[Prado.CallbackRequestManager.FIELD_CALLBACK_TARGET] = this.options.EventTarget;
- if(this.options.PostInputs != false)
+ if(this.options.PostInputs != false)
return jQuery(form).serialize() + '&' + jQuery.param(data);
else
return jQuery.param(data);
diff --git a/jQuery-WIP.txt b/jQuery-WIP.txt
index c1726b45..61fc6787 100644
--- a/jQuery-WIP.txt
+++ b/jQuery-WIP.txt
@@ -23,6 +23,7 @@ Basic postback controls (TButton, TCheckBox, TLinkButton, TRadioButton, TTextBox
Js-based controls (TTabPanel, TDatePicker, TColorPicker, TSlider, THtmlArea, TAccordion)
List, Data controls
*Validators
+Ajax queue
Basic callback controls (TActive*, TInPlaceTextBox)
Badic jquery-ui controls
@@ -31,7 +32,6 @@ TJuiAutoComplete
TJuiDraggable,TJuiDroppable
TBD
-Implement Ajax queue
Port *ratings
Add JQuery-ui-Effects: clip, explode, transfer, switchclass
Add JQuery-ui-Methods: show, hide, toggle?