Will the sortProperty attribute help?  It should sort by the actual
property value, then use the decorator for display.  You could add an
extra property to your bean that returns the double value and use that as
the sort property.  It's annoying to have to add extra properties, but it
might be the easiest way to fix the issue.

Chaudhary, Harsh wrote:
> That's what I currently have. The problem is that it is returning a
> String object. So, sorting does not work very well with this.
>
> Harsh.
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Ferguson, Jason M TSgt 805 CSPTS/SCE
> Sent: Monday, December 04, 2006 10:40 AM
> To: displaytag-user@lists.sourceforge.net
> Subject: Re: [displaytag-user] Sorting in display tag
>
>
> Here's what I did in one of my decorators:
>
>     public String getDepreciatedValue() {
>         Computer currentComputer = (Computer) getCurrentRowObject();
>         NumberFormat currencyFormat =
> NumberFormat.getCurrencyInstance();
>
>         return
> currencyFormat.format(currentComputer.getDepreciatedValue());
>     }
>
>
>
>   _____
>
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Chaudhary, Harsh
> Sent: Monday, December 04, 2006 10:33 AM
> To: displaytag-user@lists.sourceforge.net
> Subject: [displaytag-user] Sorting in display tag
>
>
> Hi all,
> I need to display a table which has columns of strings, dates and
> doubles. These need to be sortable. And that's my problem.
>
> For example, the currency column has double values and our DB is such
> that these nos could be stuff like 0.25, 9.2, 12355.210E10. But  the nos
> need to be formatted as 0.25, 9.20, 12355.22.
>
> I implemented a decorator using DecimalFormat object. The problem is
> that it returns a string. My question is how to set the no. of decimal
> places of a double or Double object to 2 decimal places. I realize this
> is not a displaytag question but other people here have got to have come
> across this.
>
> If not, how else can I do this?
>
> I will be glad to provide any more specific info if needed.
>
> Thanks,
> HC.
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
> displaytag-user mailing list
> displaytag-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/displaytag-user
>


-- 
Rick Herrick
[EMAIL PROTECTED]

Proud member of the reality-based community

Never try to discourage thinking for you are sure to succeed.--Bertrand
Russell

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to