Issue Details (XML | Word | Printable)

Key: DISPL-69
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Reporter: Dan Allen
Votes: 0
Watchers: 0
Operations

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

option to strip html before sort

Created: 18/Oct/04 11:29 AM   Updated: 26/May/05 11:22 PM   Resolved: 16/Nov/04 06:15 PM
Return to search
Component/s: Paging/Sorting
Affects Version/s: 1.0 RC2
Fix Version/s: 1.0 RC2

Time Tracking:
Not Specified

Issue Links:
dependent
 


 Description  « Hide
Often times it is necessary to allow for a conditional use of the href attribute on a column (creating a link, or not creating a link, based on the contents of the column). However, if the link is created manually inside the contents of the column tag (as opposed to using the href attribute on the column) the sorting functionality is affected because it now includes the html markup in the value of each column.

Example:

<display:column property="id" sortable="true">
  <c:if test="${not empty row.id}"><html:link action="ViewItem?id=${row.id}"><c:out value="${row.name}"/></c:if>
  <c:if test="${empty row.id}">[empty]</c:if>
</display:column>

Output:

<a href="/app/ViewItem?id=6">Mountain Bike</a>
[empty]
<a href="/app/ViewItem?id=3">Canoe</a>
<a href="/app/ViewItem?id=8">Tent</a>
[empty]

The problem with the above code is that the sort will actually occur on the value of the id rather than the name. However, since the end user sees a name in the column, that person would expect it to be sorting on name. Under no circumstance would a sort on the url be desirable.

fabrizio giustina added a comment - 16/Nov/04 06:15 PM
see DISPL-58
stripping html during sorting could be really slow: the added sortProperty attribute should provide the same functionality with a lower overhead