You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Lenny Primak <lp...@hope.nyc.ny.us> on 2011/10/25 10:53:35 UTC

How to get random-ish AJAX-created client IDs?

I guess I now have an infamous situation,
a component inside a zone, which has a mixin.

The mixin gets the client ID of it's component, which works great, until the zone gets updated.

The zone now has random-ish client ID for the component.  How do I fix my mixin so it gets the new client ID?

Thanks



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


Re: How to get random-ish AJAX-created client IDs?

Posted by Steve Eynon <st...@alienfactory.co.uk>.
My way of thinking about it is...

...if the "whole" component is rendered then the render phases are
called, but it a component is partially rendered, then they're not.

But you can always use <t:trigger /> to fire your own render events,
as mentioned here:

http://tapestry.1045711.n5.nabble.com/T5-2-Looking-For-A-RenderNotification-Mixin-Example-td4917771.html#a4920626

Steve.


On 25 October 2011 17:22, Dragan Sahpaski <dr...@gmail.com> wrote:
> Hi,
> On Tue, Oct 25, 2011 at 11:10 AM, Lenny Primak <lp...@hope.nyc.ny.us>wrote:
>
>> I don't think those are called on Ajax updates.
>
>
> SetupRender and the rest of the render phase events are called if the
> component is inside the block that updates the zone (if it's the zones body,
> than inside the zone). They aren't called on the page containing the zone.
>
>
>> I use @SetupRender now and it only works before the ajax update.
>>
>>
>> On Oct 25, 2011, at 5:00 AM, Steve Eynon <st...@alienfactory.co.uk>
>> wrote:
>>
>> > Could you use ... ?
>> >
>> > @InjectContainer
>> > private ClientElement container;
>> >
>> > void afterRender() {
>> >    container.getClientId();
>> > }
>> >
>> > Steve.
>> >
>> > On 25 October 2011 16:53, Lenny Primak <lp...@hope.nyc.ny.us> wrote:
>> >> I guess I now have an infamous situation,
>> >> a component inside a zone, which has a mixin.
>> >>
>> >> The mixin gets the client ID of it's component, which works great, until
>> the zone gets updated.
>> >>
>> >> The zone now has random-ish client ID for the component.  How do I fix
>> my mixin so it gets the new client ID?
>> >>
>> >> Thanks
>> >>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> 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


Re: How to get random-ish AJAX-created client IDs?

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
Thanks for the replies guys.
Nope, not a JSON problem...
The client IDs are correct, as the debugger tells me,
but for some reason the event handler for the form submit button isn't getting called
after a zone refresh.  I guess this question is invalid, something else is going on.

On Oct 25, 2011, at 6:29 AM, Barry Books wrote:

> Are you using JSONLiteral in your mixin?
> 
> If your mixin does some javascript and stops working with no errors
> after a zone refresh I would suspect the JSON returned on the zone
> update is invalid. When this happens the JSON parser traps the error
> so you don't see any problems but nothing works after that.
> 
> The changing client IDs can also be a problem. I wrote a selector
> binding for the tapestry5-jquery library that helps with that issue.
> 
> ---------------------------------------------------------------------
> 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


Re: How to get random-ish AJAX-created client IDs?

Posted by Barry Books <tr...@gmail.com>.
Are you using JSONLiteral in your mixin?

If your mixin does some javascript and stops working with no errors
after a zone refresh I would suspect the JSON returned on the zone
update is invalid. When this happens the JSON parser traps the error
so you don't see any problems but nothing works after that.

The changing client IDs can also be a problem. I wrote a selector
binding for the tapestry5-jquery library that helps with that issue.

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


Re: How to get random-ish AJAX-created client IDs?

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
Hmmm. I wonder why then the mixin stops working after zone update...



On Oct 25, 2011, at 5:22 AM, Dragan Sahpaski <dr...@gmail.com> wrote:

> Hi,
> On Tue, Oct 25, 2011 at 11:10 AM, Lenny Primak <lp...@hope.nyc.ny.us>wrote:
> 
>> I don't think those are called on Ajax updates.
> 
> 
> SetupRender and the rest of the render phase events are called if the
> component is inside the block that updates the zone (if it's the zones body,
> than inside the zone). They aren't called on the page containing the zone.
> 
> 
>> I use @SetupRender now and it only works before the ajax update.
>> 
>> 
>> On Oct 25, 2011, at 5:00 AM, Steve Eynon <st...@alienfactory.co.uk>
>> wrote:
>> 
>>> Could you use ... ?
>>> 
>>> @InjectContainer
>>> private ClientElement container;
>>> 
>>> void afterRender() {
>>>   container.getClientId();
>>> }
>>> 
>>> Steve.
>>> 
>>> On 25 October 2011 16:53, Lenny Primak <lp...@hope.nyc.ny.us> wrote:
>>>> I guess I now have an infamous situation,
>>>> a component inside a zone, which has a mixin.
>>>> 
>>>> The mixin gets the client ID of it's component, which works great, until
>> the zone gets updated.
>>>> 
>>>> The zone now has random-ish client ID for the component.  How do I fix
>> my mixin so it gets the new client ID?
>>>> 
>>>> Thanks
>>>> 
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> 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


Re: How to get random-ish AJAX-created client IDs?

Posted by Dragan Sahpaski <dr...@gmail.com>.
Hi,
On Tue, Oct 25, 2011 at 11:10 AM, Lenny Primak <lp...@hope.nyc.ny.us>wrote:

> I don't think those are called on Ajax updates.


SetupRender and the rest of the render phase events are called if the
component is inside the block that updates the zone (if it's the zones body,
than inside the zone). They aren't called on the page containing the zone.


> I use @SetupRender now and it only works before the ajax update.
>
>
> On Oct 25, 2011, at 5:00 AM, Steve Eynon <st...@alienfactory.co.uk>
> wrote:
>
> > Could you use ... ?
> >
> > @InjectContainer
> > private ClientElement container;
> >
> > void afterRender() {
> >    container.getClientId();
> > }
> >
> > Steve.
> >
> > On 25 October 2011 16:53, Lenny Primak <lp...@hope.nyc.ny.us> wrote:
> >> I guess I now have an infamous situation,
> >> a component inside a zone, which has a mixin.
> >>
> >> The mixin gets the client ID of it's component, which works great, until
> the zone gets updated.
> >>
> >> The zone now has random-ish client ID for the component.  How do I fix
> my mixin so it gets the new client ID?
> >>
> >> Thanks
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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
>
>

Re: How to get random-ish AJAX-created client IDs?

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
I don't think those are called on Ajax updates.   I use @SetupRender now and it only works before the ajax update. 


On Oct 25, 2011, at 5:00 AM, Steve Eynon <st...@alienfactory.co.uk> wrote:

> Could you use ... ?
> 
> @InjectContainer
> private ClientElement container;
> 
> void afterRender() {
>    container.getClientId();
> }
> 
> Steve.
> 
> On 25 October 2011 16:53, Lenny Primak <lp...@hope.nyc.ny.us> wrote:
>> I guess I now have an infamous situation,
>> a component inside a zone, which has a mixin.
>> 
>> The mixin gets the client ID of it's component, which works great, until the zone gets updated.
>> 
>> The zone now has random-ish client ID for the component.  How do I fix my mixin so it gets the new client ID?
>> 
>> Thanks
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> 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


Re: How to get random-ish AJAX-created client IDs?

Posted by Steve Eynon <st...@alienfactory.co.uk>.
Could you use ... ?

@InjectContainer
private ClientElement container;

void afterRender() {
    container.getClientId();
}

Steve.

On 25 October 2011 16:53, Lenny Primak <lp...@hope.nyc.ny.us> wrote:
> I guess I now have an infamous situation,
> a component inside a zone, which has a mixin.
>
> The mixin gets the client ID of it's component, which works great, until the zone gets updated.
>
> The zone now has random-ish client ID for the component.  How do I fix my mixin so it gets the new client ID?
>
> Thanks
>
>
>
> ---------------------------------------------------------------------
> 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