ffjavierr...@yahoo.es wrote: > > > > Hi, > > I am using DisplayTag in my tables and I have a problem. I would like > the first column has a count of the number of the records. I have > write the next column: > > <% int cont = 1 %> > <displaytag:column> > <%=cont++%> > </displaytag > > and it works ok with one exception, if I order the table by other > column the count is disordered. For example, I have the next table > ordered by id(the first record is the tiles): > > > count ------ id ----- name > 1 ----------- a1 ----- Juan > 2 ---------- a2 ------ Pepe > 3 ---------- a3 ------ Arturo > > then, when I order by "name" then i have: > > count ------ id ------ name > 3 ---------- a3 ------ Arturo > 1 ----------- a1 ----- Juan > 2 ---------- a2 ------ Pepe > > and i would like have: > count ------ id ------ name > 1 ---------- a3 ------ Arturo > 2 ----------- a1 ----- Juan > 3 ---------- a2 ------ Pepe > > > Thanks and sorry by bad english > > Try using a TableDecorator:
public class MyDecorator extends TableDecorator { private int row = 0; public String getRowNum() { return "" + (++row); } } and <display:table ... decorator="MyDecorator"> <display:column property="rowNum"/> ... </display:table> (The above is untested) Ed! ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ displaytag-user mailing list displaytag-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-user