Hello,

I've managed to get the displayTag paging from my server side very 
nicely using an implementation of the PaginatedList interface. It all 
works very well and is pretty straight forward apart from getting the 
column sort functionality to work. The order doesn't change from 
sort=asc on the request when the user clicks the title link spin button.

I have searched the archives but only found this trail

http://sourceforge.net/mailarchive/message.php?msg_id=4206234.249318%40sourceforge.net

Its exactly the same problem as I am having.

The root of the problem is that I don't understand how displayTag 
changes the SortOrderEnum it gets back from the PaginatedList 
getSOrtDirection(). In my spring-mcv controller I get the sorting 
direction from the request like this

[code]

String sortDirection = 
ServletRequestUtils.getStringParameter(httpServletRequest, "dir");

[/code]

Then I create my PaginatedListImpl class and set the sortDirection 
String field with the value I just got from the request. In my getList() 
method of my PaginatedListImpl I get the limited list from the DAO and 
reverse it according to the sortDirection. Nice and simple, No problems 
there.

In my PaginatedList impl I have the following for the getSortDirection:

[code]

if(sortDirection.equals("desc")) return SortOrderEnum.ASCENDING;
else return SortOrderEnum.DESCENDING;


[/code]

Now here's the part I don't understand. DisplayTag calls the 
getSortDirection() when it renders to work out which order to place on 
the request when the user clicks the spin button. I know this because I 
followed the advice in the thread linked above and when I change what 
the getSortDirection() returns the initial page loads up with either the 
top or bottom spin button highlighted and either sort='asc' or 
sort='desc' on the request.

When my PagintedListImpl gets the String 'desc' from the request the 
getSortDirection() method will return SortOrderEnum.ASCENDING, when its 
'asc' it will return SortOrderEnum.DESCENDING

But......why doesn't displaytag get the opposing SortOrderEnum object I 
return depending upon what I get from the request and change the 
highlighted spin button????????????????

Its very annoying, I guess I haven't understood how DisplayTag deals 
with the SortOrderEnum it gets from getSortDirection() correctly. The 
rest of the PaginatedList implementation seems very straight forward 
except for this, so I am sure I have misunderstood how I should 
implement the sorting part.

Any advice or help would be much appreciated, I've spent two days 
hitting spin buttons now!

Many thanks.

John.

-------------------------------------------------------------------------
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

Reply via email to