Spring Roo
  1. Spring Roo
  2. ROO-651

Pagination links can show empty lists when going to larger page size

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Complete
    • Affects Version/s: 1.0.2.RELEASE
    • Fix Version/s: 1.1.0.M1
    • Component/s: WEB MVC
    • Labels:
      None

      Description

      Create a simple app as follows:

      project --topLevelPackage pizza
      persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY 
      entity --class ~.Pizza 
      controller all --package ~.web

      Start the app and create 11 Pizzas. Click the "List all Pizzas" link and you will correctly see this:

      Go to page 2, and you will correctly see this:

      Click the "15" link, and you will see "No Pizzas found". A power user might realise from that link's target URL that the list is empty because it's displaying page 2 with a page size of 15, but most users would be surprised to see an empty list. Instead, they would expect to see all 11 pizzas on a single page (I hallway-tested this theory on some non-technical colleagues).

      In general terms, increasing the page size will wrongly show an empty list when the new page size times the current page number exceeds the number of available results. The only way to provide consistent, unsurprising behaviour is to go back to page 1 when changing the page size, as the page numbers that correspond to the previous page size no longer make sense.

      P.S. When testing or replicating this, please be aware of the navigation problems caused by ROO-650.

        Activity

        Hide
        Stefan Schmidt added a comment -

        Fixed in rev 729. The page param is now always reset to 1 if the list size is changed.

        Show
        Stefan Schmidt added a comment - Fixed in rev 729. The page param is now always reset to 1 if the list size is changed.
        Hide
        whyBish added a comment -

        just a thought, but isn't resetting to page 1 just as annoying, shouldn't it be something like:

        if
        x=old page
        y=old results per page
        z=new results per page
        n=new page
        then
        fx=(x-1)*y
        fn=(n-1)*z
        fx=fn
        solving for n
        (x-1)*y=(n-1)*z
        n=[(x-1)*y/z]+1
        guaranteeing that the first element on the old page will still be in the new page?

        example:
        x=2
        y=10
        z=15
        then
        n=1
        as required in original scenario

        or:
        x=2
        y=10
        z=5
        then
        n=3
        so the 11th item is still the first item on the third page when switching to 5 results per page

        Show
        whyBish added a comment - just a thought, but isn't resetting to page 1 just as annoying, shouldn't it be something like: if x=old page y=old results per page z=new results per page n=new page then fx=(x-1)*y fn=(n-1)*z fx=fn solving for n (x-1)*y=(n-1)*z n= [(x-1)*y/z] +1 guaranteeing that the first element on the old page will still be in the new page? example: x=2 y=10 z=15 then n=1 as required in original scenario or: x=2 y=10 z=5 then n=3 so the 11th item is still the first item on the third page when switching to 5 results per page

          People

          • Assignee:
            Stefan Schmidt
            Reporter:
            Andrew Swan
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: