DisplayTag

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

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.1
  • Fix Version/s: 1.1
  • Component/s: Paging/Sorting
  • Labels:
    None
  • Application server:
    Apache Tomcat/5.0.28

Description

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)

Activity

Hide
Kurt Martinsen added a comment -
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.
Show
Kurt Martinsen added a comment - 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.
Hide
fabrizio giustina added a comment -
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.
Show
fabrizio giustina added a comment - 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.
Hide
fabrizio giustina added a comment -
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.
Show
fabrizio giustina added a comment - 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.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
1d
Original Estimate - 1 day
Remaining:
1d
Remaining Estimate - 1 day
Logged:
Not Specified
Time Spent - Not Specified