You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by isaac n <is...@gmail.com> on 2005/12/06 06:05:07 UTC

Removing items from a @For component

Hello everyone,

I have a @For component that's based on a list of objects. The @For
component is set up with "delete" buttons for each row, so that clicking the
button deletes that row.

The problem is, after the Delete button's listener gets called, Tapestry
throws a ConcurrentModificationException.  I dug deeper and noticed that the
ForBean (which underlies @For) is using an iterator which was created before
the element was removed from the list -- which is what causes the exception.

I imagine this is a common issue, since it should be possible to remove
elements from a @For component without breaking it. Is there a standard
solution to this problem?

Thanks!

Re: Removing items from a @For component

Posted by isaac n <is...@gmail.com>.
On 12/5/05, Konstantin Ignatyev <kg...@yahoo.com> wrote:
>
> The same trick with deferred method execution would do the trick,
>
> http://article.gmane.org/gmane.comp.java.tapestry.user/19946/match=ignatyev+submit
> or simply set ID of the element to delete in the listener but perform
> actual deletion in the onSubmit method of the form.
>
>
> isaac n <is...@gmail.com> wrote: Hello everyone,
>
> I have a @For component that's based on a list of objects. The @For
> component is set up with "delete" buttons for each row, so that clicking
> the
> button deletes that row.
>
> The problem is, after the Delete button's listener gets called, Tapestry
> throws a ConcurrentModificationException.  I dug deeper and noticed that
> the
> ForBean (which underlies @For) is using an iterator which was created
> before
> the element was removed from the list -- which is what causes the
> exception.
>
> I imagine this is a common issue, since it should be possible to remove
> elements from a @For component without breaking it. Is there a standard
> solution to this problem?
>
> Thanks!


Thanks.  I was considering using deferred execution, but was hoping that
Tapestry had a more streamlined way of doing this.  Too bad it doesn't.

Issue with Javascript and a ForEach loop

Posted by Tony Herstell <to...@cambridgesoftware.co.nz>.
<TR bgcolor="#f0f0f0" id="ognl:auditInProgress.datasourceUniqueId"
onmouseover="highlight(true, 'ognl:auditInProgress.datasourceUniqueId')"
onmouseout="highlight(false, 'ognl:auditInProgress.datasourceUniqueId')"
jwcid="@Foreach" element="TR" source="ognl:auditsInProgress"
value="ognl:auditInProgress">


This works: 
id="ognl:auditInProgress.datasourceUniqueId"


These:
onmouseover="highlight(true, 'ognl:auditInProgress.datasourceUniqueId')"
don’t work.. and it seems no variant does either (have tried a few!).

There must be an easy solution...

Thanks in advance...




-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.13.11/191 - Release Date: 2/12/2005
 


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


Re: Removing items from a @For component

Posted by Konstantin Ignatyev <kg...@yahoo.com>.
The same trick with deferred method execution would do the trick,
 http://article.gmane.org/gmane.comp.java.tapestry.user/19946/match=ignatyev+submit
 or simply set ID of the element to delete in the listener but perform actual deletion in the onSubmit method of the form.
 

isaac n <is...@gmail.com> wrote: Hello everyone,

I have a @For component that's based on a list of objects. The @For
component is set up with "delete" buttons for each row, so that clicking the
button deletes that row.

The problem is, after the Delete button's listener gets called, Tapestry
throws a ConcurrentModificationException.  I dug deeper and noticed that the
ForBean (which underlies @For) is using an iterator which was created before
the element was removed from the list -- which is what causes the exception.

I imagine this is a common issue, since it should be possible to remove
elements from a @For component without breaking it. Is there a standard
solution to this problem?

Thanks!




Konstantin Ignatyev




PS: If this is a typical day on planet earth, humans will add fifteen million tons of carbon to the atmosphere, destroy 115 square miles of tropical rainforest, create seventy-two miles of desert, eliminate between forty to one hundred species, erode seventy-one million tons of topsoil, add 2,700 tons of CFCs to the stratosphere, and increase their population by 263,000

Bowers, C.A.  The Culture of Denial:  Why the Environmental Movement Needs a Strategy for Reforming Universities and Public Schools.  New York:  State University of New York Press, 1997: (4) (5) (p.206)