Issue Details (XML | Word | Printable)

Key: DISPL-280
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Reporter: Kurt Martinsen
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DisplayTag

Sortable header links fail when using external sorting and an integer as the sortName.

Created: 08/Feb/06 05:50 AM   Updated: 08/Feb/06 03:30 PM   Resolved: 08/Feb/06 03:30 PM
Return to search
Component/s: Paging/Sorting
Affects Version/s: 1.1
Fix Version/s: 1.1

Time Tracking:
Original Estimate: 1 day
Original Estimate - 1 day
Remaining Estimate: 1 day
Remaining Estimate - 1 day
Time Spent: Not Specified
Time Spent - Not Specified

Application server: Apache Tomcat/5.0.28


 Description  « Hide
Snapshot displaytag-1.1-20060103.091119-1

When using external sorting, if the column property "sortName" is an integer (for example an index in a collection) it is interpreted as Display tag's sortedColumnNumber instead of sortedColumnName.

This results in failure of generating the correct header link for the sorted column (CSS style, ascending/descending).

My quick fix was to simply set the value to both the sortedColumnNumber and the sortedColumnName, when the integer is parsed succesfully. org.displaytag.tags.TableTag.initParameters line 886. (displaytag-1.1-20060103.091119-1)

Kurt Martinsen added a comment - 08/Feb/06 08:09 AM
Snapshot displaytag-1.1-20060103.091119-1

This also affects sorting if the sortName integer happens to fall in the range of headerCellList.size() - 1. In this case the rows are sorted by Display tag even though external sorting is used. This happens in org.displaytag.model.TableModel.getSortedColumnHeader.

The actual problem might be in org.displaytag.tags.TableTag.doEndTag line 1198. (this.paginatedList == null || this.tableModel.isLocalSort()). When using external sorting without implementing the PaginatedList interface, the if statement resolves as true and continues on to sorting a paged list.

fabrizio giustina added a comment - 08/Feb/06 02:23 PM
fixed the #2 issue: sorting doesn't occur anymore when sort="external" is used. Thanks for reporting this.

About the first issue: I will see if I can fix this for 1.1 by adding an additional parameter (btw, the suggestion of setting both sortedColumnNumber and sortedColumnName can' work since it will always fail if you don't use the "sortName" property). If not, I will update the documentation by clearly saying that the sortname parameter value can't be a number.

fabrizio giustina added a comment - 08/Feb/06 03:30 PM
fixed the #1 issue too. Added an additional parameter when sorting is performed using column name, instead of that ugly try/catch block to detect if the value is an integer.