You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by ownedthx <se...@gmail.com> on 2009/05/18 17:47:40 UTC
In Ajax request to component causing another component a chance to
render
Here's my scenario...
I want to create a component with an embedded form that has a textfield, and
on submit, fires an Ajax request to the component. However, I have this
idea that I'd like to let this component fire a custom event (using
triggerEvent) back up to the page, and the page could tell another component
on the page to go through the render lifecycle, because the info in this
event warrants this other component to update it's content.
The technical hurdle with this approach, I think, is that when a component
receives an AJAX event, it's the only thing that gets a chance to go through
the rendering lifecycle... and I don't see anyway to somehow have another
component to re-render too.One note: I'm avoiding using zone updates to
orchestrate this cross-component behavior, because in my understanding, the
bulk of the logic has to then live in Javascript in the client. But if
that's what I have to do, OK...
Thanks for any help!
Seth
--
View this message in context: http://www.nabble.com/In-Ajax-request-to-component-causing-another-component-a-chance-to-render-tp23599118p23599118.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: In Ajax request to component causing another component a chance
to render
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Mon, 18 May 2009 14:28:59 -0300, ownedthx <se...@gmail.com> escreveu:
> Oh. I think I get it. If the zone contains another component, then
> that'd cause it to render, right?
Yes. The zone, and everything inside it, is rerendered.
Your pseudomarkup looks correct. ;)
--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: In Ajax request to component causing another component a chance
to render
Posted by ownedthx <se...@gmail.com>.
Oh. I think I get it. If the zone contains another component, then that'd
cause it to render, right?
Let me see if I get this right with some pseudomarkup:
Root page (that contains the two components, searchForm and searchResults):
<html>
<t:searchForm zoneToUpdate="literal:wrapper"
searchTerm="prop:searchTerm" />
<t:zone t:id="wrapper">
<t:searchResults searchTerm="prop:searchTerm" />
</t:zone>
</html>
Search Form component:
<div>
<t:form zone="prop:wrapper">
<t:textarea t:id="searchTerm" />
</t:form>
</div>
Search Results component:
<div>
... loop over property 'searchTerm'
</div>
Thanks much Thiago,
Seth
Thiago H. de Paula Figueiredo wrote:
>
> Em Mon, 18 May 2009 13:44:05 -0300, ownedthx <se...@gmail.com>
> escreveu:
>
>> Let me try an example. Take a pretty rich web app like markmail:
>> http://tapestry.markmail.org/search/?q=tapestry
>>
>> When you search on markmail, it causes a whole page refresh. (not what
>> I'm trying to do). But, what if instead it updated just the applicable
>> components on the page, such as the search results, using Ajax? This is
>> basically what I'm trying to accomplish with my web app.
>
> Just use a zone surrounding the results page and update it when the user
> submits the search form. And don't forget that, in Tapestry 5.1.0.5, you
> can update more than one zone in the same form submit or event.
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/In-Ajax-request-to-component-causing-another-component-a-chance-to-render-tp23599118p23601991.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: In Ajax request to component causing another component a chance
to render
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Mon, 18 May 2009 13:44:05 -0300, ownedthx <se...@gmail.com> escreveu:
> Let me try an example. Take a pretty rich web app like markmail:
> http://tapestry.markmail.org/search/?q=tapestry
>
> When you search on markmail, it causes a whole page refresh. (not what
> I'm trying to do). But, what if instead it updated just the applicable
> components on the page, such as the search results, using Ajax? This is
> basically what I'm trying to accomplish with my web app.
Just use a zone surrounding the results page and update it when the user
submits the search form. And don't forget that, in Tapestry 5.1.0.5, you
can update more than one zone in the same form submit or event.
--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: In Ajax request to component causing another component a chance
to render
Posted by ownedthx <se...@gmail.com>.
Let me try an example. Take a pretty rich web app like markmail:
http://tapestry.markmail.org/search/?q=tapestry
When you search on markmail, it causes a whole page refresh. (not what I'm
trying to do). But, what if instead it updated just the applicable
components on the page, such as the search results, using Ajax? This is
basically what I'm trying to accomplish with my web app.
In general, I think one could argue that the 'richer' your application
becomes (fatter webpages with alot of Ajax), the higher chance you might
want something like this. I think there are less common usecases why this
would be useful for more traditional web apps.
Seth
Thiago H. de Paula Figueiredo wrote:
>
> On Mon, May 18, 2009 at 12:47 PM, ownedthx <se...@gmail.com> wrote:
>> One note: I'm avoiding using zone updates to
>> orchestrate this cross-component behavior, because in my understanding,
>> the
>> bulk of the logic has to then live in Javascript in the client.
>
> Why? Just curious. :)
>
> --
> Thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/In-Ajax-request-to-component-causing-another-component-a-chance-to-render-tp23599118p23601157.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: In Ajax request to component causing another component a chance
to render
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, May 18, 2009 at 12:47 PM, ownedthx <se...@gmail.com> wrote:
> One note: I'm avoiding using zone updates to
> orchestrate this cross-component behavior, because in my understanding, the
> bulk of the logic has to then live in Javascript in the client.
Why? Just curious. :)
--
Thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org