Use the "sortProperty" attribute on the column. Try this...

  <display:column title="Votes" style="width:15%;text-align:center;" 
sortable="true" sortProperty="beanIntProperty" headerClass="link-padrao">
   <bean:write name="son" property="nuVotes" />
  </display:column>

Where "beanIntProperty" is a bean method that returns the column value as an 
int. Try that...


From: Elvis Rodrigues da Silva [mailto:elvis.si...@bsb.politec.com.br]
Sent: Thursday, September 10, 2009 6:34 PM
To: displaytag-user@lists.sourceforge.net
Subject: [displaytag-user] Dynamic Columns X Bean Write

I'm facing a big problem using dynamic columns. I have a collection with some 
parameters, among them another collection that must be converted to columns of 
that line. I've developed a good solution, thanks to Google and persistence, 
but...

The dynamic column (inside the forEach in the example at the end of the e-mail) 
is having its value printed with bean:write. However, the values are numeric 
and i need to use the automatic ordering. As i'm using bean:write, it is 
ordering as if the values were strings, and, '100' comes before '2' with this 
approach. I've tried to use the property attribute of the tag display:column, 
but it didn't work. I've tried property="son.nuVotes", 
property="${son.nuVotes}" or property="${nuVotes}" but they didn't work, sadly. 
If i use property="nuVotes" it works, but access the nuVotes attribute of the 
'father' object, not of the 'son', because they are implemented by the same 
java class.

I hope i was able to make it clear. If someone can help me, i would be very 
thankful.
Here is the code excerpt:

<display:table id="father" 
name="consultarResultadoEleicaoForm.detalharResultadoEleicaoTO.listaDescricao" 
export="true" class="table-grid" pagesize="10" 
requestURI="/do/sisped/detalharResultadoEleicao" sort="list">
 <display:column title="Place" property="description" 
style="width:30%;text-align:center;" sortable="true" headerClass="link-padrao"/>
 <c:forEach var="son" items="${father.listVotes}" >
  <display:column title="Votes" style="width:15%;text-align:center;" 
sortable="true" headerClass="link-padrao">
   <bean:write name="son" property="nuVotes" />
  </display:column>
 </c:forEach>
 <display:column title="Total" property="total" 
style="width:20%;text-align:center;" sortable="true" headerClass="link-padrao"/>
</display:table>


Thanks in advance,


[cid:image001.gif@01CA3272.52573D30]

Elvis Rodrigues
Analista Arquiteto
Politec Global IT Services
+55(61) 3038-6989
elvis.si...@bsb.politec.com.br
www.politec.com.br




No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.409 / Virus Database: 270.13.89/2359 - Release Date: 09/10/09 
18:12:00

<<inline: image001.gif>>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to