You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jesse Kuhnert <jk...@gmail.com> on 2007/03/06 05:11:44 UTC

Re: Programmatic DirectLink with updateComponents and parameter

I'm not sure what all of this search/replace/sweep stuff is but basic
updates should work . .. Maybe if you try again with an example I can
understand easier I can help.

p.s. You can use updateComponents="basket_container" or
updateComponents="basket_container, another_container" now if you
want...Support was added in for easier string list expressions.

On 2/21/07, Andreas Pardeike <ap...@fsys.se> wrote:
> Hi,
>
> I've seen some examples on how to generate a DirectLink programmatic but
> so far, I couldn't get it to work. Especially because I need it to
> update
> a component via ajax.
>
> Quick overview: I parse external static html text with fake links and
> replace those links with the correct versions. One of them is a [Buy]
> button
> and it needs to call a listener to add the item to the database and
> then it
> refreshes the view on the page via ajax.
>
> On my normal Tapestry pages, this looks like:
>
> <component id="buy_link" type="DirectLink">
>    <binding name="listener" value="listener:doAddToBasket"/>
>    <binding name="parameters" value="new java.lang.Object[]
> { item_id, 1, '' }"/>
>    <binding name="updateComponents" value="{'basket_container'}"/>
>    <binding name="async" value="true"/>
> </component>
>
> and this works fine. Now, on my "content" page which will read in a
> specific
> html page via a given name, I do a search/replace sweep and there, I
> need to
> do the same (the basket component is in my Border).
>
> What I have done is to have a fake_buy component similar to the one
> above in
> my content page and a property 'item_id' which is referred by
> fake_by. I was
> able to do this:
>
> setItem_id(linkParam);
> DirectLink fakeBuy = (DirectLink)getComponent("fake_buy");
> ILink fakeBuyLink = fakeBuy.getLink(getPage().getRequestCycle());
> link = fakeBuyLink.getURL();
>
> But I am not sure if this is the right way to do it because I fear side
> effects.
>
> Andreas Pardeike
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

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