DisplayTag
  1. DisplayTag
  2. DISPL-36

dynamic pagesize (user decision)

    Details

    • Type: New Feature New Feature
    • Status: Open Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.0 RC1
    • Fix Version/s: TBD
    • Component/s: Paging/Sorting
    • Labels:
      None

      Description

      ====
      imported from sf tracker
      id 1011575
      submitted by Ralf Hauser - ralfhauser
      http://sourceforge.net/support/tracker.php?aid=1011575
      ====


      e.g. with webmail inbox, typically the provider
      suggests a pagination default size (e.g. 20), but users
      often can choose to increase that to 50, 100, or all

      probably, this is possible without an enhancement to
      the library jar, but it would be great to add a working
      example/tutorial example derived from
      http://www.displaytag.org/example-paging.jsp

        Activity

        Hide
        Ashish Patel added a comment -
        Has this been implemented? I tried several different ways in my jsp to implement this feature but neither worked. It's definitely a nice feature to have.

        This is what I did (or tried to do):

        In my Struts application, I simply allow the user to set a certain pagesize and then make that pagesize available in the session scope. In each JSP page that uses DisplayTag, I tried this:

        setdisplaypref = (String) session.getAttribute("setDisplayPref");

        And then tried:

        <display:table uid="t1" name="sessionScope.results" pagesize="<%setdisplaypref%>" export="true" defaultorder="descending">

        However this does not work.
        Show
        Ashish Patel added a comment - Has this been implemented? I tried several different ways in my jsp to implement this feature but neither worked. It's definitely a nice feature to have. This is what I did (or tried to do): In my Struts application, I simply allow the user to set a certain pagesize and then make that pagesize available in the session scope. In each JSP page that uses DisplayTag, I tried this: setdisplaypref = (String) session.getAttribute("setDisplayPref"); And then tried: <display:table uid="t1" name="sessionScope.results" pagesize="<%setdisplaypref%>" export="true" defaultorder="descending"> However this does not work.
        Hide
        Ralf Hauser added a comment -
        I got it working with
        <% String pgSize = (String) session.getAttribute("pgSiz");
        if (pgSize == null ||
        pgSize.length() == 0) {pgSize ="30";}
        int pgSizeInt = Integer.valueOf(pgSize).intValue();
        session.setAttribute("pgSiz", pgSize);
        %>
        //some calculations on list size
        <display:table uid="t1" name="sessionScope.results" pagesize="<%=pgSizeInt%>"" export="true" defaultorder="descending">
        Show
        Ralf Hauser added a comment - I got it working with <% String pgSize = (String) session.getAttribute("pgSiz"); if (pgSize == null || pgSize.length() == 0) {pgSize ="30";} int pgSizeInt = Integer.valueOf(pgSize).intValue(); session.setAttribute("pgSiz", pgSize); %> //some calculations on list size <display:table uid="t1" name="sessionScope.results" pagesize="<%=pgSizeInt%>"" export="true" defaultorder="descending">
        Hide
        Kevin Conaway added a comment -
        I am attaching a patch which I believe fixes this issue. It allows for the pagesize property to be an expression as well as an int.

        This patch also fixes DISPL-312.

        Thanks,

        Kevin
        Show
        Kevin Conaway added a comment - I am attaching a patch which I believe fixes this issue. It allows for the pagesize property to be an expression as well as an int. This patch also fixes DISPL-312 . Thanks, Kevin
        Hide
        David added a comment -
        Is there any reason why Kevin's patch was never checked in?

        I'm currently experiencing this issue with Struts 2 and it looks like the attached patch should fix the problem. Can someone from displaytag review the code and apply the patch? If not, what other changes need to be made?

        Thanks!
        Show
        David added a comment - Is there any reason why Kevin's patch was never checked in? I'm currently experiencing this issue with Struts 2 and it looks like the attached patch should fix the problem. Can someone from displaytag review the code and apply the patch? If not, what other changes need to be made? Thanks!

          People

          • Reporter:
            fabrizio giustina
          • Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated: