You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Barry Books <tr...@gmail.com> on 2011/08/11 15:00:19 UTC

Is there a way to get the current rendering component?

I'm implementing a selector binding for jQuery. I'd like to be able to
do something like

<t:any>${selector:this}</t:any>

and have selector:this emit the html id of its container if it
supports getClientId().

I've look thru the docs and I can't find any easy way to do this. Did
I just overlook something or is there another way to do something like
this?

Thanks
Barry

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


Re: Is there a way to get the current rendering component?

Posted by Barry Books <tr...@gmail.com>.
That worked and solved the component not yet rendered problem so

<t:any t:id="first" >${selector:this} ${selector:test}</t:any>
<t:any >${selector:this}</t:any>
<t:any >${selector:this}</t:any>
<t:any t:id="test">${selector:this} ${selector:first}</t:any>

outputs

jQuery('#first') jQuery(selector['test'])
jQuery('#any')
jQuery('#any_0')
jQuery('#test') jQuery('#first')

var $ = jQuery; Tapestry.DEBUG_ENABLED = true; var selector = new Array();
Tapestry.onDOMLoaded(function() {
selector['test'] = '#test';});

Thanks
Barry

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


Re: Is there a way to get the current rendering component?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, 11 Aug 2011 10:00:19 -0300, Barry Books <tr...@gmail.com> wrote:

> I'm implementing a selector binding for jQuery. I'd like to be able to
> do something like
>
> <t:any>${selector:this}</t:any>
>
> and have selector:this emit the html id of its container if it
> supports getClientId().

Not out of the box. I'd try to implement a mixin that with an  
@InjectContainer field to get the component instance and then apply it to  
all components implementing a ComponentClassTransformWorker.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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