Thanks Ville, that's very helpful. I think I'll just stick with my known object ref as the key and do a match on the list through iteration - saves some messing about. Ideally what I wanted from the grid is an index / ref that survives sorting (though has predictable behavior for additions / deletions) so it can be used for a get(index) on the source list - something like an originalIndex as opposed to a currentDisplayContextIndex - I'm would guess augmenting the model with that would be trivial but I'm aware these are general purpose components and can't really be expected to fit every specific requirement. In my case the object refs are a compound key, and when passed through an activation context require coercion, and then a check using key.equals(otherKey) per list entry until matched, which is just a few extra cpu cycles I could ideally get rid of. As you say the cost shouldn't be too much. The map backed grid seems too much square peg round hole for me. Thanks for the suggestions all the same.
Regards, Jim. -----Original Message----- From: Ville Virtanen [mailto:ville.virta...@cerion.fi] Sent: 18 July 2010 17:56 To: users@tapestry.apache.org Subject: RE: t:grid, inPlace and rowIndex Hi, you can calculate the exact index of the row by injecting the grid to the page and calculating it by using methods (getRowsPerPage() x getCurrentPage()) + index. (http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/corelib/components/Grid.html) The index of course changes when you reorder the list. Also, this index should be updated when doing inPlace update as the index changes depending in which place you insert the new row. Should the list that contains the entities be a map instead? (Map<Key, Entity>) You may have to implement your own GridDataSource that uses the map, as there is no automatic wrapping for that datatype. (See: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/grid/CollectionGridDataSource.java?revision=964086&view=markup for reference implementation for collections.) The cost to iterate the list when doing deletes shouldn't be that much performance wise - and if you have so many entities that the cost is too much you should consider implementing special GridDataSource anyway. - Ville jc1001 wrote: > > Hi Thiago, > > I've tried that - but the index is the position within the current 'page' > of entries in the grid, i.e. zero is the first entry on page one, and also > on page 2 etc., but also, the inPlace method won't work as the index can't > be updated because some render phase is skipped. I guess what I'm looking > for is some initial index position within the grid (list) entries that is > not updated during sorting, and so has no need to be updated during an > inPlace update. > > Regards, > Jim. > > -----Original Message----- > From: Thiago H. de Paula Figueiredo [mailto:thiag...@gmail.com] > Sent: 15 July 2010 22:49 > To: Tapestry users > Subject: Re: t:grid, inPlace and rowIndex > > On Thu, 15 Jul 2010 18:25:03 -0300, Jim O'Callaghan > <jc1000...@yahoo.co.uk> wrote: > >> I'm using the grid to display a selection where one of the cells is an >> ActionLink that currently passes the entity key for use in a detail >> screen> for via the context, > > Have yout tried passing the index as the context for your ActionLink? > > -- > Thiago H. de Paula Figueiredo > Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, > and instructor > Owner, Ars Machina Tecnologia da Informa??o Ltda. > http://www.arsmachina.com.br > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > -- View this message in context: http://old.nabble.com/t%3Agrid%2C-inPlace-and-rowIndex-tp29177730p29198096.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org