I am sure we have all looked at this before. I locally patched the latest
cvs version to solve a problem I encountered while applying this library at
work.
I wanted to bring them to the dev group before I commit the change. Sound
cool?
This patch will fix the bug where you can't page through a sorted column.
Here are the changes I made:
// UPDATE 1 -- check for the paging parameter. If it exists, don't attempt
to overwrite it.
TableTag.java: line 739
// UPDATE 2 -- build a separate paging url as a concatenation of the
requestURI and paging parms if present (page, sort and order)
TableTag.java 1351
The diff is pasted below. This was one of the refactorings I did last year
on this tag. It doesn't look like I am going to check in the stuff I did
then, but try to incorporate it into what ever we have going forward.
c:\cvsnt\cvs.exe diff -r HEAD TableTag.java
Index: TableTag.java
===================================================================
RCS file:
/cvsroot/displaytag/displaytag/src/org/apache/taglibs/display/TableTag.java,
v
retrieving revision 1.12
diff -r1.12 TableTag.java
739c739
< if
(!prop.getProperty("sort.behavior").equalsIgnoreCase("page")) {
---
> if
(!prop.getProperty("sort.behavior").equalsIgnoreCase("page") &&
req.getParameter("page") == null) {
1351,1361c1351,1358
< String url = this.requestURI;
< if (url == null) {
< url = req.getRequestURI();
< }
< // url += req.getQueryString();
<
< // flag to determine if we should use a ? or a &
< int index = url.indexOf('?');
< String separator = "";
< if (index == -1) {
< separator = "?";
---
> String url = this.requestURI == null ?
> req.getRequestURI() : this.requestURI;
>
> String separator = url.indexOf('?') == -1 ? "?" : "&";
>
> StringBuffer pagingUrl = new StringBuffer(url).append(separator);
> if(this.sortColumn > -1) {
> pagingUrl.append("sort=").append(this.sortColumn).append("&");
1363,1364c1360,1361
< else {
< separator = "&";
---
> if(req.getParameter("order")!=null) {
> pagingUrl.append("order=").append((this.sortOrder ==
TableTag.SORT_ORDER_ASCEENDING ?"asc":"dec")).append("&");
1387c1384
< buf.append(helper.getPageNavigationBar(url + separator +
"page={0,number,#}"));
---
>
buf.append(helper.getPageNavigationBar(pagingUrl.append("&page={0,number,#}"
).toString()));
CVS command finished execution
Ben
-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
_______________________________________________
displaytag-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel