[
http://jira.codehaus.org/browse/DISPL-501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_115028
]
allan flatoff commented on DISPL-501:
-------------------------------------
I altered the decorator to use a different name from the property:
public String getDocumentTitleWithLink() {
Row currentRow = (Row)getCurrentRowObject();
String pidString = currentRow.getPidString();
String documentTitle = currentRow.getDocumentTitle();
return "<a href=\"/BPView/docOpener.jsp?pid=" + pidString + "\"
target=\"_blank\" class=\"doclinks\"><nobr>" + documentTitle + "</nobr></a>";
}
**
I then set the table to display the altered property but sort on the real one:
<display:column property="documentTitleWithLink" title="Doc Title"
sortable="true" sortProperty="documentTitle" headerClass="sortable"/>
This worked. Much cleaner than a javascript hack I threw together.
Thanks!
> Column sorting is broken with a decorator
> -----------------------------------------
>
> Key: DISPL-501
> URL: http://jira.codehaus.org/browse/DISPL-501
> Project: DisplayTag
> Issue Type: Bug
> Components: Paging/Sorting
> Affects Versions: 1.1.1
> Reporter: allan flatoff
>
> I created a column called "Document Title". I created a Table Decorator so I
> could wrap a URL around the data (since the current linking implementation
> does not support target="" in the hyperlink).
> Example Decorator:
> public String getDocumentTitle() {
> Row currentRow = (Row)getCurrentRowObject();
> String pidString = currentRow.getPidString();
> String documentTitle = currentRow.getDocumentTitle();
> return "<a href=\"/BPView/docOpener.jsp?pid=" + pidString + "\"
> target=\"_blank\" class=\"doclinks\"><nobr>" + documentTitle + "</nobr></a>";
> }
> After doing this, the column no longer sorted on the data that was in my
> "documentTitle" property, instead it sorted on the TEXT that was put into the
> documentTitle after the decorator had been applied - so effectively I was
> sorting on "pidString" instead.
> Note that in the current URL linking mechanism, applying a URL does not alter
> the Sorting. It still sorts on the data from the column instead of the URL
> that was wrapped around the hyperlink.
> Similarly, adding a decoration to a column should not have an effect on the
> sort. Perhaps there could be an optional parameter sortOnDecoratedColumn or
> something which would allow you to specify to sort on the actual data or the
> "decorated data" for the column.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
displaytag-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel