Jesse,
Thanks for your response. This feels like the problem, that the IDs on
the <div> tags are not being matched. However due to my lack of
knowledge about Tapestry's internals, I haven't been able to implement
your suggestion.
What I can't figure out is how to get the clientId out of the OGNL
expression you used (page.components.div1.clientId). I had a look at
what is in the Map that page.components returns, and I don't see
anything that looks like my components' clientIds in either the
component.getClientId() or in the set of keys of the components Map.
How do I get the clientId from a component named "div1", given that I'm
in a For loop as well? I'm confused about what the updateComponents
parameter in the DirectLink component should take instead of the IDs on
the <div>s since I can't seem to retrieve the clientIds.
Here is what I am doing now, using components with IDs to try to follow
your example:
In the .jwc file I have two components for <div>s that look like this:
<component id="div1" type="Any">
<binding name="id" value="ognl:'ratingStars' + hunch.id"/>
</component>
<component id="div2" type="Any">
<binding name="id" value="ognl:'ratingImage' + hunch.id"/>
</component>
These are used to display the <div>s in the .html file, which will be
updated by the asynchronous DirectLink.
Then in my DirectLink component:
<a jwcid="@DirectLink"
listener="listener:submitRatingAjax"
async="ognl:true"
updateComponents="ognl:{'ratingImage' +
hunch.id,'ratingStars' + hunch.id}">...</a>
If you or anyone else can help direct me to the right way to get the
clientIds for components for use within the updateComponents parameter,
that would be greatly appreciated. I have looked at the source code and
APIs but so far that hasn't cleared it up.
Cheers,
Matt
Jesse Kuhnert wrote:
> Hmm... You can try adding some of the server side logging stuff
> outlined here:
http://tapestry.apache.org/tapestry4.1/ajax/debugging.html
> .
>
> I'm guessing that the clientId of the div's you are trying to update
> doesn't match on these responses.
>
> One thing you could do as a test is if you currently do something
like:
>
> <a jwcid="@DirectLink" updateComponents="div1,div2"
>
> change it to :
>
> <a jwcid="@DirectLink"
> updateComponents="ognl:{page.components.div1.clientId,
> page.components.div2.clientId}"
>
> I noticed something similar to this recently and probably need to make
> updateComponents="a,b" automatically use the clientId and not
> componentId to match id's on the response.
>
> Hopefully that's the problem.
>
> On 4/8/07, Matt Larson <[EMAIL PROTECTED]> wrote:
>> I have just run into a problem that I think is probably a bug, but
may
>> be something that I am doing wrong. It's definitely a showstopper
in my
>> app, though.
>>
>> I have a component that allows users to rate something via the normal
>> kind of "stars" rating. After a user clicks a star the overall
rating
>> of the object is calculated and displayed as a graphic. I use a
>> component that employs an asynchronous DirectLink to do this, with
each
>> star having a different value on submit, and it works quite
nicely. I
>> have this custom component on two different pages and I can submit
>> ratings on both.
>>
>> However, I just added pagination, and as soon as you move off of the
>> home page via the "next" pagination link, the DirectLink for
ratings no
>> longer returns anything. The pagination works using the standard
kind of
>> "start from" parameter, which calls a listener that simply does
>> setStartFrom(int startFrom) and then lets the pageBeginRender()
method
>> calculate the objects to display.
>>
>> I do know the reason that the ratings no longer show the updated
>> graphic--the AjaxResponse just returns empty tags, with no errors
>> reported at all (had a look at this with firebug):
>>
>> <ajax-response></ajax-response>
>>
>> The actual link is firing just fine, and all of the server side
>> processing happens as my logs show. It's just that the ajax
response is
>> empty when it should include new HTML for the <div>s to be
updated. It
>> seems like there is some kind of setup that happens when you go
directly
>> to Home.html and click the rating link, but not when I've gone to the
>> home page via a DirectLink. I cannot see what would be different,
since
>> my pageBeginRender() method is called, and everything else happens
just
>> like it should in the component and in the page.
>>
>> If anyone has run into this before or has an idea regarding what this
>> might cause an async DirectLink to return nothing in some cases,
please
>> let me know. The pagination is a major part of my app, and users
need
>> to be able to submit ratings no matter which page they are on, so
I am
>> kind of dead in the water until I get this fixed. Next step is to
spend
>> quality time with the source code, but if anyone has a better idea
>> before I take that time...
>>
>> Cheers,
>> Matt
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]