jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • DisplayTag
  • DISPL-203

Date Sorting with Table Decorator

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.0
  • Fix Version/s: TBD
  • Component/s: Decorators
  • Labels:
    None
  • Application server:
    Weblogic v8.1

Description

Hello,
I have been using display tag with column decorators in my project, recently there was case where we have to use the value in session to decide on the decoration of a column, As column decorator isn't supporting PageContext as of v1.0, i switched to Table decorator,everything works fine except sorting of Date Object Columns. The same column sorting is working fine with "Column Decorator". Date based sorting is very important in the existing functionality and i would request you to kindly help me with this issue. Please find the code snippet attached.
  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Text File
    Decorator.txt
    12/Apr/05 6:51 AM
    0.7 kB
    Narayanan A
  2. Text File
    work-around.txt
    26/Apr/05 8:02 AM
    2 kB
    ${attachment.displayAuthor}

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Anonymous added a comment - 26/Apr/05 8:02 AM
Work-around code
Show
Anonymous added a comment - 26/Apr/05 8:02 AM Work-around code
Hide
Permalink
Anonymous added a comment - 26/Apr/05 8:12 AM
Hello,

I managed to solve this one with some work-aound. There is a condition in the compare method of RowSorter class, this logic checks for the decorator and the getterMethod of the property. If a getterMethod is found for the property it uses the decorated value for sorting and not the underlying object. In my case the underlying object was java.util.Date ,but it was always sorting based on the decorated value instead of the object.

Please find my work-around for this problem.
Added a new dummy Property with attribute sortProperty=originalProperty and added a getterMethod for the dummyProperty in my decorator class. Please find the attached file work-around.txt.

Can we have an attribute something like "sortByObject=true" in future release, so that we need not have to do any work around and decide the sorting pattern at the tag level.
Show
Anonymous added a comment - 26/Apr/05 8:12 AM Hello, I managed to solve this one with some work-aound. There is a condition in the compare method of RowSorter class, this logic checks for the decorator and the getterMethod of the property. If a getterMethod is found for the property it uses the decorated value for sorting and not the underlying object. In my case the underlying object was java.util.Date ,but it was always sorting based on the decorated value instead of the object. Please find my work-around for this problem. Added a new dummy Property with attribute sortProperty=originalProperty and added a getterMethod for the dummyProperty in my decorator class. Please find the attached file work-around.txt. Can we have an attribute something like "sortByObject=true" in future release, so that we need not have to do any work around and decide the sorting pattern at the tag level.
Hide
Permalink
Narayanan A added a comment - 26/Apr/05 8:14 AM
Hello,

I managed to solve this one with some work-aound. There is a condition in the compare method of RowSorter class, this logic checks for the decorator and the getterMethod of the property. If a getterMethod is found for the property it uses the decorated value for sorting and not the underlying object. In my case the underlying object was java.util.Date ,but it was always sorting based on the decorated value instead of the object.

Please find my work-around for this problem.
Added a new dummy Property with attribute sortProperty=originalProperty and added a getterMethod for the dummyProperty in my decorator class. Please find the attached file work-around.txt.

Can we have an attribute something like "sortByObject=true" in future release, so that we need not have to do any work around and decide the sorting pattern at the tag level.
Show
Narayanan A added a comment - 26/Apr/05 8:14 AM Hello, I managed to solve this one with some work-aound. There is a condition in the compare method of RowSorter class, this logic checks for the decorator and the getterMethod of the property. If a getterMethod is found for the property it uses the decorated value for sorting and not the underlying object. In my case the underlying object was java.util.Date ,but it was always sorting based on the decorated value instead of the object. Please find my work-around for this problem. Added a new dummy Property with attribute sortProperty=originalProperty and added a getterMethod for the dummyProperty in my decorator class. Please find the attached file work-around.txt. Can we have an attribute something like "sortByObject=true" in future release, so that we need not have to do any work around and decide the sorting pattern at the tag level.
Hide
Permalink
Ralf Hauser added a comment - 18/Dec/09 11:31 AM
public String getYourDateSortable() {
return String.valueOf(yourDate.getTime());
}

should be a work-around - see also http://stevelibonati.wordpress.com/2008/08/26/display-tag-date-column-sorting/
Show
Ralf Hauser added a comment - 18/Dec/09 11:31 AM public String getYourDateSortable() { return String.valueOf(yourDate.getTime()); } should be a work-around - see also http://stevelibonati.wordpress.com/2008/08/26/display-tag-date-column-sorting/
Hide
Permalink
Michael Osipov added a comment - 29/Dec/09 3:18 PM
Guys, there is a format attribute on the column tag. You're done.
Show
Michael Osipov added a comment - 29/Dec/09 3:18 PM Guys, there is a format attribute on the column tag. You're done.
Hide
Permalink
José Manuel de la Torre added a comment - 10/Oct/11 3:11 AM
For decoration use property="decoratedProperty".
For ordering use sortProperty="property".
Show
José Manuel de la Torre added a comment - 10/Oct/11 3:11 AM For decoration use property="decoratedProperty". For ordering use sortProperty="property".

People

  • Reporter:
    Narayanan A
Vote (0)
Watch (2)

Dates

  • Created:
    12/Apr/05 6:51 AM
    Updated:
    10/Oct/11 3:11 AM

Time Tracking

Estimated:
1m
Original Estimate - 1 minute
Remaining:
1m
Remaining Estimate - 1 minute
Logged:
Not Specified
Time Spent - Not Specified
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.