You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2010/02/03 02:18:35 UTC

svn commit: r905858 - /tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js

Author: hlship
Date: Wed Feb  3 01:18:34 2010
New Revision: 905858

URL: http://svn.apache.org/viewvc?rev=905858&view=rev
Log:
Split the trigger behavior for zone updates into two parts (the initial "click" event, and a new Tapestry event) so faciliate splicing in a confirmation step between the two.

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js?rev=905858&r1=905857&r2=905858&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js Wed Feb  3 01:18:34 2010
@@ -44,6 +44,9 @@
 
     /** Event, fired on a zone element when the zone is updated with new content. */
     ZONE_UPDATED_EVENT : "tapestry:zoneupdated",
+    
+    /** Event fired on a link or submit to request that it request that the correct ZoneManager update from a provided URL. */    
+    TRIGGER_ZONE_UPDATE_EVENT : "tapestry:triggerzoneupdate",     	
 
     /** When false, the default, the Tapestry.debug() function will be a no-op. */
     DEBUG_ENABLED : false,
@@ -801,7 +804,12 @@
 
         element.observe(eventName, function(event)
         {
-            Event.stop(event);
+            event.stop();
+            
+            element.fire(Tapestry.TRIGGER_ZONE_UPDATE_EVENT);
+        });
+        
+        element.observe(Tapestry.TRIGGER_ZONE_UPDATE_EVENT, function() {
 
             var zoneObject = Tapestry.findZoneManager(element);
 
@@ -809,9 +817,11 @@
             
             var newUrl = url;
 
+            // A hack related to allowing a Select to perform an Ajax update of the page.
+            
             if(element.tagName == "SELECT" && element.value)
             {
-            	newUrl+='&t:selectvalue='+element.value;
+            	newUrl += '&t:selectvalue=' +element.value;
             }
 
             zoneObject.updateFromURL(newUrl);