Re: Trouble updating component after async. directlink : clientId's generated in For-loops
Thank you for the response. That is exactly what I wanted. But ... something is still odd. I get too and mixed up updates back to in the ajax-response requests. Is this a bug or expected behaviour? _Click on first row :_ Tapestry / DojoAjaxResponseBuilder sends * response id=therow type=element (actually containing both first and second row(!) * response id=initializationscript type=script Works fine. _Click on second row :_ * response id=Insert type=element * response id=therow_0 type=element * response id=DirectLink type=element ie. of first row * response id=initializationscript type=script DOJO warns: WARNING: 10:06:53 AM: No node could be found to update content in with id Insert _Click on third row :_ response id=Insert_1 type=element * response id=DirectLink_0 type=element * response id=initializationscript type=script DOJO warns: WARNING: 10:05:40 AM: No node could be found to update content in with id Insert_1 /kim andyhot wrote: Sam Gendler wrote: On 11/21/06, andyhot [EMAIL PROTECTED] wrote: updateComponents=ognl:components.therow.clientId Can I suggest that we get this into the docs in some way. It stumps a lot of people, including myself. http://issues.apache.org/jira/browse/TAPESTRY-1137 proposes a binding for that exact use-case, i.e. updateComponents=clientId:therow Also, it seems like if I want to update a component by calling ResponseBuilder.updateComponent() from within a listener method, I have to give it the id of the component, rather than the clientId. In that case, does it only update the current instance of the component accessed by that id, or will it update every component that uses that id as the code iterates over a collection in some way? If it is the former, how would I update the row that follows the current row? Is it even possible? --sam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Tlf. +45 7214 6793 · [EMAIL PROTECTED] · MSN: [EMAIL PROTECTED] Atira A/S · Niels Jernes Vej 10 · 9220 Aalborg SØ · www.atira.dk - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Re: Trouble updating component after async. directlink : clientId's generated in For-loops
On 11/21/06, andyhot [EMAIL PROTECTED] wrote: updateComponents=ognl:components.therow.clientId Can I suggest that we get this into the docs in some way. It stumps a lot of people, including myself. Also, it seems like if I want to update a component by calling ResponseBuilder.updateComponent() from within a listener method, I have to give it the id of the component, rather than the clientId. In that case, does it only update the current instance of the component accessed by that id, or will it update every component that uses that id as the code iterates over a collection in some way? If it is the former, how would I update the row that follows the current row? Is it even possible? --sam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Trouble updating component after async. directlink : clientId's generated in For-loops
In a page containing elements generated by a component placed under a For-Loop component I want to be able to update a single such component/element using the very nifty DojoAjaxResponseBuilder.updateComponent() feature. In summary I want to have a DirectLink for each row in a table. The listener method for this DirectLink will update data, the row should be updated via the updateComponents attribute of DirectLink. But... how do I address components generated (and thus named) by a For-loop? updateComponents=therow will work for first row updateComponents=therow_2 does not work at all (sends updates to the Insert and DirectLink components in stead! updateComponents=ognl:'therow_' + theIndex has the same behaviour. . Hopefully this small example illustrates my issue: one column for data one for the async DirectLink to listener aListener. This code works for the _first_ row but not the other two. *The html* div jwcid=@Shell title=Test div jwcid=@Body class=templatewide table border=1 cellpadding=5 span jwcid=@For source=ognl:rows value=ognl:row index=ognl:theIndex tr jwcid=[EMAIL PROTECTED] td span jwcid=@Insert value=ognl:row /span /td td a jwcid=@DirectLink listener=listener:aListener async=true parameters=ognl:{theIndex} updateComponents=rowid Update this row! /a /td /tr /span /table /div /div *The Page Class* import org.apache.tapestry.IRequestCycle; import org.apache.tapestry.annotations.Persist; import org.apache.tapestry.event.PageEvent; import dk.atira.tapestry.AbstractBasePage; public abstract class NumericPage extends AbstractBasePage { @Persist public abstract String[] getRows(); public abstract void setRows(String[] rows); public abstract String getRow(); public abstract int getTheIndex(); @Override public void pageBeginRender(PageEvent e) { if (getRows() == null){ setRows(new String[] {foo, bar, baz}); } } public void aListener(IRequestCycle cycle, int idx) { getRows()[idx] = + (int)(Math.random()*1); } } /thanks kim -- Tlf. +45 7214 6793 · [EMAIL PROTECTED] · MSN: [EMAIL PROTECTED] Atira A/S · Niels Jernes Vej 10 · 9220 Aalborg SØ · www.atira.dk - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]