I'm trying to get the contrib:table to format my data (date, currency,
numbers, etc) then be able to sort it.
I'm using Tapestry 4 beta 2.
I'm able to get it to format properly, probably not the "correct" way - I
use a method from my bean that is being rendered in my table to format the
value and return it as a String. The problem I have now is that when I
sort, I'm sorting strings, when it really needs to be sorting number, dates,
etc.
Here's what I have in my .page file:
<component id="membersTableView" type="contrib:TableView">
<binding name="source" value="ognl:members" />
<binding name="columns">
Account Number:accountNumber, First Name:firstName, Last
Avg Purchase:"$" + formatCurrency(amount), Number
Visits:formatNumber(visitCnt),
Last Date:formatDate(lastDate)
</binding>
</component>
<component id="membersTableColumns" type="contrib:TableColumns" />
<component id="membersTablePages" type="contrib:TablePages" />
<component id="membersTableFormRows" type="contrib:TableRows"></component>
<component id="membersTableValues" type="contrib:TableValues" />
The methods (formatCurrency, formatNumber, formatDate) are in my "Member"
bean that the table is rendering. So this works for the format, but when I
sort by clicking on the column headers they are now strings, which doesn't
work as needed.
Any advice is greatly appreciated.
Thanks,
Joe