Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Display tag and sorting

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using Display tag library provided by Sourcefourge.net for pagination, It works great for me. The problem is it doesn't do the sorting independent of upper case and lower case. I want to do the sorting independent of upper case and lower case.
Does any one used this tag library before and solved this problem or somebody know how can I solve this issue ??
thanks to all.
 
Marshal
Posts: 27211
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tracked down the documentation and read it.

If you want a fix now, then you should add another property to your beans that contains a version of your strings in all lower-case and use that property as the sortProperty attribute. Something as simple asshould work. Or you could volunteer to work on the project and add new attributes that allow providing a Comparator or a Collator to the sort. It is open-source so you could do that.
 
shailesh kumar
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply but the solution which you gave me is to convert all the data to lower case, thats not what I want. I am sorry If was unable to explain properly. Here is the example.
This is my data:

A
a
B
b
C
c
D
d

My Business Object has this data and initially it displays as shown above which is independent of uppercase and lowercase. When I click on this column to do the sorting using display tag, it displays as

A
B
C
D
a
b
c
d

This is the problem it should do the sorting independent of case.
 
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't worked on Display tag library but if you follow the lines of Paul you must be able to do case insensitive sorting.

Assuming the tag library sorts on all java objects you can do the following:

- Create a Wrapper for the data you want to perform case insensitive sorting as shown below:



And use this wrapper class in the display object.
[ January 19, 2006: Message edited by: Purushothaman Thambu ]
 
Paul Clapham
Marshal
Posts: 27211
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by shailesh kumar:
Thanks for the reply but the solution which you gave me is to convert all the data to lower case, thats not what I want. I am sorry If was unable to explain properly.

Obviously I didn't explain properly either.

I understood your explanation. The code I posted was not intended to convert all the data to lower case, and in fact it does not do that. It just provides a separate property in your bean that you can use for sorting. Only for sorting. Do not use this property for displaying. Display the "data" property but sort on the "caseInsensitiveData" property.
 
shailesh kumar
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, I got it..
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Shailesh,

It would be helpful if you can tell us how you fixed this problem.

Thanks
 
You don't know me, but I've been looking all over the world for. Thanks to the help from this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic