I have a column that is a derived value - its value is the elapsed time of a message being processed, and we record start and end times. Atm I have this in my table:
which is almost what I want. The processingTime tag simply formats the time as 0.541 for example.
This is fine, apart from the problem that the time is treated as alpha-numeric, and as such sorting doesn't work. What I would like to do instead is something like:
but I'd then be faced with the same problem, as the Decorator interface requires you to return a String, rather than an object. Am I missing something, or should I be able to return an object here?
cheers
dim
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the end I've worked around it by having a wrapper for my bean that provides the virtual column as a Double. The formatting isn't perfect, but its better than the sort not working...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I came across a similar issue a few weeks back, except mine dealt with displaying a javascript href link in a cell, yet sorting on it's non-decorated value.
What I did was to go in and add another tag property called nonDecoratedValue which then allowed compare to operate properly. However, since you are using a tag and not a actual bean value, Comparable will probably not work in this case.
Hi,
I have a column that is a derived value - its value is the elapsed time of a message being processed, and we record start and end times. Atm I have this in my table:
<display:column style="width: 40px;" sortable="true" title="Time"><console:processingTime name="ibusReq" /></display:column>
which is almost what I want. The processingTime tag simply formats the time as 0.541 for example.
This is fine, apart from the problem that the time is treated as alpha-numeric, and as such sorting doesn't work. What I would like to do instead is something like:
<display:column style="width: 40px;" sortable="true" title="Time" decorator="com.mycompany.TimeDecorator" />
but I'd then be faced with the same problem, as the Decorator interface requires you to return a String, rather than an object. Am I missing something, or should I be able to return an object here?
cheers
dim
In the end I've worked around it by having a wrapper for my bean that provides the virtual column as a Double. The formatting isn't perfect, but its better than the sort not working...
Hi Dim,
I came across a similar issue a few weeks back, except mine dealt with displaying a javascript href link in a cell, yet sorting on it's non-decorated value.
What I did was to go in and add another tag property called nonDecoratedValue which then allowed compare to operate properly. However, since you are using a tag and not a actual bean value, Comparable will probably not work in this case.
You can check the status of my changes here:
http://jira.codehaus.org/browse/DISPL-58
Needless to say, they have not been added yet to the code base. However, my source changes are there and maybe they might be of help.