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/07/24 13:28:50 UTC

[2/3] git commit: WICKET-4668 Ajax responses for QUEUE and DROP type channels are not guaranteed to be processed in the order of the requests

WICKET-4668 Ajax responses for QUEUE and DROP type channels are not guaranteed to be processed in the order of the requests

Make a copy of the passed attributes so that it is possible to trigger the handler with custom data (jQuery(selector).triggerHandler('eventName', CUSTOM_DATA))


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

Branch: refs/heads/master
Commit: 5171f95b8618644ce98ecb1cb7f8767c9fa491a5
Parents: 9774c87
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Tue Jul 24 14:14:08 2012 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Tue Jul 24 14:14:08 2012 +0300

----------------------------------------------------------------------
 .../wicket/ajax/res/js/wicket-ajax-jquery.js       |   18 +++++++++-----
 1 files changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/5171f95b/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 2bfbbda..3206685 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
@@ -1553,23 +1553,27 @@
 				}
 
 				jQuery.each(attrs.e, function (idx, evt) {
-					Wicket.Event.add(attrs.c, evt, function (jqEvent) {
+					Wicket.Event.add(attrs.c, evt, function (jqEvent, data) {
 						var call = new Wicket.Ajax.Call();
-						attrs.event = Wicket.Event.fix(jqEvent);
+						var attributes = jQuery.extend({}, attrs);
+						attributes.event = Wicket.Event.fix(jqEvent);
+						if (data) {
+							attributes.event.extraData = data;
+						}
 
-						var throttlingSettings = attrs.tr;
+						var throttlingSettings = attributes.tr;
 						if (throttlingSettings) {
 							var postponeTimerOnUpdate = throttlingSettings.p || false;
 							var throttler = new Wicket.Throttler(postponeTimerOnUpdate);
 							throttler.throttle(throttlingSettings.id, throttlingSettings.d,
 								Wicket.bind(function () {
-									call.ajax(attrs);
-									return attrs.ad;
+									call.ajax(attributes);
+									return attributes.ad;
 								}, this));
 						}
 						else {
-							call.ajax(attrs);
-							return attrs.ad;
+							call.ajax(attributes);
+							return attributes.ad;
 						}
 					});
 				});