You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Guerin Laurent <lg...@sopragroup.com> on 2011/06/16 21:02:19 UTC

RE : RE : Mixin competes with Zone's event handler

Yep, forgot to mention the replacement and the potential consequence when original event differ from the normal click event.
Thanks for the add :-)

________________________________________
De : Josh Canfield [joshcanfield@gmail.com]

/*
 * Replace the normal click event, knowing that in most cases, the
 * original link or button has an Tapestry.ACTION_EVENT event handler to
 * do its real work.
*/
element.stopObserving("click");


On Thu, Jun 16, 2011 at 10:55 AM, Guerin Laurent <lg...@sopragroup.com> wrote:
> Perhaps, i have missing something, but i think you can, by setting the parameter InitializationPriority.LATE on your Javascript initialisation call :
>
>        // Late, to overwrite other event handlers
>        javascriptSupport.addInitializerCall(InitializationPriority.LATE, "yourModalBoxBuilder", spec);
>
> In this way, your handle has the priority and you'll be able stop the initial event fired by the actionlink (even if there is an ajax zone).
>
> This is what is done by the Confirm modalBox mixin written by Howard into tapx project :
>  https://github.com/hlship/tapx/blob/master/tapx-core/src/main/java/com/howardlewisship/tapx/core/mixins/Confirm.java
>
> My 2 cents :-)
>
> Laurent
> ________________________________________
> De : Josh Canfield [joshcanfield@gmail.com]
> Date d'envoi : jeudi 16 juin 2011 18:48
> À : Tapestry users
> Objet : Re: Mixin competes with Zone's event handler
>
>> is there any way to manage to execute the Tapestry.ZoneManager's event
>> handler only after user clicks Yes button on my mixin's Yes button?
>
> No, I don't believe you can. As I recall it binds to click on the <a>
> and events are executed in an undefined order.
>
> The following link from the list describes doing exactly what you're
> looking for.
>
> http://tapestry-users.832.n2.nabble.com/quot-Confirm-quot-mixin-won-t-cancel-when-in-zone-td5048950.html#a5048950
>
> Josh
>
> On Thu, Jun 16, 2011 at 8:42 AM, Nicolas Barrera <nb...@gmail.com> wrote:
>> Hi T5 users!
>>
>> I got the following problem (I dsthink my mixin is competing with the Zone's
>> javascript code when the actionLink I apply my mixing has also a t:zone),
>>
>> i 'm developing a confirmation dialog box Mixin... (using some cool modal
>> window plugin)
>>
>> that is.., i got an ActionLink with t:mixin="confirmBox" attribute so when i
>> click on it a dialog box appears with two buttons (Yes/No) if I click No the
>> dialog box dissapears and
>> the page remain the same (I 'm using prototype's Event.stop(e) here)
>>
>> If I click Yes, then the dialog box dissapears and the page should do what
>> clicking in an ordinary eventLink would do.
>>
>>
>> The problem arises when I apply my mixin to an actionLink which also has a
>> zone associated to it, in this case the dialog box appears but rapidly
>> dissapears and the zone is refreshed, first it seemed that
>> the Event.stop(e) wasn't working but then,
>>
>> I realized that the actionLink had two listeners to the action link's
>> onclick event:
>>
>> * My event handler
>> * And the Tapestry.ZoneManager event handler where he does the ajax request
>> and refreshes the zone
>>
>>
>> is there any way to manage to execute the Tapestry.ZoneManager's event
>> handler only after user clicks Yes button on my mixin's Yes button?
>>
>> cheers and thanks in advance!
>>
>> Nicolás.-
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org