You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Gareth <g0...@yahoo.co.uk> on 2006/10/16 14:52:19 UTC

For component ConcurrentModificationException during rewind.

hi,

I am making use of the tapestry For loop in my HTML to create a table (I'm using this rather than a table due to the simplicity).

I have 3 columns of data, and 2 buttons per row.  one button deletes the row, and the other changes all fields to edit boxes so it can be amended.

At the bottom of the table I have an "Add new row" button, which adds a new row to the table.

The problem is that... 

If there are x rows of data in the table, selecting the delete button for row x - 2 (where x is the bottom row in the table), causes the ConcurrentModificationException to occur since I assume on deleting the row, it cannot then load the next row for rewind.

I have gotten around the problem by, in the listener for "onDelete", I flag the row for deletion, and then in the "PageBeginRender" method, I check to see that it is not rewinding - i.e. it is about to start rendering the response, and if the deletion flag is set, remove the corresponding row.

This is all very well, but I can't work out where to put this code to delete the record when I extract this functionality into a custom component.

I've got Kent's Book, and couldn't locate anything to help

Does anyone have any suggestions?


Thanks

Gareth

Send instant messages to your online friends http://uk.messenger.yahoo.com 

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


Re: For component ConcurrentModificationException during rewind.

Posted by Christian Haselbach <ch...@tngtech.com>.
Zitat von Gareth <g0...@yahoo.co.uk>:

> I have gotten around the problem by, in the listener for "onDelete", I flag
> the row for deletion, and then in the "PageBeginRender" method, I check to
> see that it is not rewinding - i.e. it is about to start rendering the
> response, and if the deletion flag is set, remove the corresponding row.

You could use the "action" parameter instead of the "listener"
parmeter in the submit component. This should be called after
the loop has been rewinded.
See http://tapestry.apache.org/tapestry4/tapestry/ComponentReference/Submit.html

Or you could create a new list, initialized with the original
list, to run the for loop. This might be expensiv, depending
on the size of the list.

Regards,
Christian

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