I have implemented something like this. I have a link to my page, e.g.
index.jsp, with a view parameter. If view=paged, then the pagesize
attribute is set to my desired page size. If view=all, the pagesize is set
to the size of the list (but the pagesize="0" tip from Ed is cool, I didn't
know that). If view isn't specified, then you can do whichever way you want
to be the default.
So the page looks something like:
<%-- Calculate the pagesize based on the view value. --%>
<%-- This uses 10 as the default if view is paged or --%>
<%-- view is not specified. If view is all, the size --%>
<%-- is calculated from the list size. --%>
<c:choose>
<c:when test="${param.view == 'all'}">
<c:set var="pagesize" value="${fn:length(list)}"/>
</c:when>
<c:otherwise>
<c:set var="pagesize" value="10"/>
</c:otherwise>
</c:choose>
<%-- Display table --%>
<display:table ... pagesize="${pagesize}">
...
</display:table>
<%-- Pick which paging link to show. If all is --%>
<%-- is specified, show paged, and vice versa. --%>
<c:choose>
<c:when test="${param.view == 'all'}">
<a href="index.jsp?view=paged>View Paged</a>
</c:when>
<c:otherwise>
<a href="index.jsp?view=all>View All</a>
</c:otherwise>
</c:choose>
Again, in that top block, you should be able to discard the fn:length() and
just specify 0, but I haven't done that myself.
Rick Herrick
[EMAIL PROTECTED]
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:displaytag-user-
> [EMAIL PROTECTED] On Behalf Of Tim Fennell
> Sent: Wednesday, March 15, 2006 4:32 AM
> To: [email protected]
> Subject: Re: [displaytag-user] How to configure a table to show all items
>
> It sounds like there might be an interesting enhancement here
> though. Even with paging turned on, say with pagesize="25", it'd be
> quite nice to have display tag render a "Show All" link along with
> the paging links. Obviously this would have to be configurable to
> some degree (on/off, limit on rows for show "all"). But it'd be
> quite handy where most users will want to page but some users want to
> see everything at once...
>
> -t
>
> On Mar 15, 2006, at 5:02 AM, Ed Webb wrote:
>
> >
> >
> > Zsolt wrote:
> >> Hi,
> >>
> >> I use the paging of displaytag but sometime it would be useful to
> >> show all
> >> items of a table without paging.
> >>
> >> How can I do that?
> >>
> >> I use 1.1.
> >> Zsolt
> >>
> >
> > If you set the pagesize attribute to 0 it will show all the items.
> >
> > <display:table name="data" id="d" pagesize="0">
> > </display:table>
> >
> > Ed!
> >
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by xPML, a groundbreaking scripting
> > language
> > that extends applications into web and mobile media. Attend the
> > live webcast
> > and join the prime developer group breaking into this new coding
> > territory!
> > http://sel.as-us.falkag.net/sel?
> > cmd=lnk&kid=110944&bid=241720&dat=121642
> > _______________________________________________
> > displaytag-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/displaytag-user
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting
> language
> that extends applications into web and mobile media. Attend the live
> webcast
> and join the prime developer group breaking into this new coding
> territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> displaytag-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/displaytag-user
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
displaytag-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/displaytag-user