So am I the only one here using display-tag and needing to sort numbers ? There must be an easy way to sort numbers, that I have not identified ! Have fun, [EMAIL PROTECTED] The Computing Froggy
----- Message d'origine ---- De : Laurent ROCHE <[EMAIL PROTECTED]> À : displaytag-user@lists.sourceforge.net Envoyé le : Jeudi, 9 Août 2007, 16h27mn 31s Objet : [displaytag-user] Re : sort numbers stock is a Long. Here is an extract of the class being used : public class StockManagementQuery implements java.io.Serializable { private Integer partId; private Long stock private Integer stockMin; public Long getStock { return this.stock ; } public void setStock(Long stock ) { this.stock = stock ; } } Of course, I could have another getter with a different name that would send back the same value. (something like public Long getStock2 { return this.stock ; } And use that in the display tag for sorting. <display:column property="stock" escapeXml="false" sortProperty="stock2" sortable="true" titleKey="f.stock.header" /> But I am trying to avoid that if possible. Have fun, [EMAIL PROTECTED] The Computing Froggy ----- Message d'origine ---- De : José Renato <[EMAIL PROTECTED]> À : displaytag-user@lists.sourceforge.net Envoyé le : Jeudi, 9 Août 2007, 14h47mn 17s Objet : Re: [displaytag-user] sort numbers Hi Laurent, Is stock simple String? I have a suggestion: public class MyStock { private String stock; public String getStock() { return this.stock; } public void setStock(String stovk) { this.stock = stock; } public int getStockWrapped() { return Integer.parseInt(this.stock) }; //parse exception... try/catch! } And when using it... <display:column property="stock" escapeXml="false" sortProperty="stockWrapped" sortable="true" titleKey="f.stock.header" /> I belive that Display Tag will show stock (property) in the html page normally and it will use its int representation (stockWrapped) for sort purposes. Test it. Best Regards, José Renato. Laurent ROCHE escreveu: > Hi, > > I am sure this is common problem, but I could not find anything about this on > display tag web site and I was not able to search through the mailing list > archives (server time out). > > I have a column with numbers and I would like to be able to sort it in a > numeric way instaed of an alphabetic way, e.g. I want 10 to be after 5 and > not before because 1 is before 5 alphabetically. > > I have tried to use sortProperty="stock" but the column itself is stock so > that does not work. > Full line is: > <display:column property="stock" escapeXml="false" sortProperty="stock" > sortable="true" titleKey="f.stock.header" /> > > > Cheers, > [EMAIL PROTECTED] > The Computing Froggy > > > > > > _____________________________________________________________________________ > Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > displaytag-user mailing list > displaytag-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/displaytag-user > > > ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ displaytag-user mailing list displaytag-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-user _____________________________________________________________________________ Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ displaytag-user mailing list displaytag-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-user _____________________________________________________________________________ Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ displaytag-user mailing list displaytag-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-user