You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2012/06/13 15:45:49 UTC

[1/2] git commit: WICKET-4606 dynamic extra parameter gets used/executed even when ajaxcallistener is preconditioned to false

Updated Branches:
  refs/heads/master aa46135a5 -> bf1340b71


WICKET-4606 dynamic extra parameter gets used/executed even when ajaxcallistener is preconditioned to false

Move the calculation of dynamic extra parameters after the call to the precondition. I.e. make it as late as possible.


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/bf1340b7
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/bf1340b7
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/bf1340b7

Branch: refs/heads/master
Commit: bf1340b710f24093bcb928e79f9285a5f57ff0a2
Parents: 8d2f63e
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Jun 13 16:44:50 2012 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Jun 13 16:44:50 2012 +0300

----------------------------------------------------------------------
 .../wicket/ajax/res/js/wicket-ajax-jquery.js       |   39 +++++++++------
 1 files changed, 23 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/bf1340b7/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
index fa454de..fea9400 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
@@ -455,22 +455,6 @@
 				headers["Wicket-FocusedElementId"] = Wicket.Focus.lastFocusId;
 			}
 
-			// collect the dynamic extra parameters
-			if (jQuery.isArray(attrs.dep)) {
-				var deps = attrs.dep;
-				for (var i = 0; i < deps.length; i++) {
-					var dep = deps[i],
-						extraParam;
-					if (jQuery.isFunction(dep)) {
-						extraParam = dep(attrs);
-					} else {
-						extraParam = new Function('attrs', dep)(attrs);
-					}
-					extraParam = this._asParamArray(extraParam);
-					data = data.concat(extraParam);
-				}
-			}
-
 			if (attrs.mp) { // multipart form. jQuery doesn't help here ...
 				// TODO Wicket.next - should we execute all handlers ?!
 				// Wicket 1.5 didn't support success/failure handlers for this, but we can do it
@@ -523,6 +507,29 @@
 						}
 					}
 
+					// collect the dynamic extra parameters
+					if (jQuery.isArray(attrs.dep)) {
+						var deps = attrs.dep,
+							params = [],
+							queryString,
+							separator;
+
+						for (var i = 0; i < deps.length; i++) {
+							var dep = deps[i],
+								extraParam;
+							if (jQuery.isFunction(dep)) {
+								extraParam = dep(attrs);
+							} else {
+								extraParam = new Function('attrs', dep)(attrs);
+							}
+							extraParam = this._asParamArray(extraParam);
+							params = params.concat(extraParam);
+						}
+						queryString = jQuery.param(params);
+						separator = settings.url.indexOf('?') > -1 ? '&' : '?';
+						settings.url = settings.url + separator + queryString;
+					}
+
 					Wicket.Event.publish('/ajax/call/before', attrs, jqXHR, settings);
 					self._executeHandlers(attrs.bh, attrs, jqXHR, settings);