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

Reply via email to