Uploaded image for project: 'Magnolia Standard Templating Kit (closed)'
  1. Magnolia Standard Templating Kit (closed)
  2. MGNLSTK-744

Paging broken due to wrong offset calculation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.4.3
    • 1.4.2
    • None
    • None
    • all systems
    • Yes

      STKPager calculates wrong sublist for display due to an error in the offset calculation. This was introduced by the update from 1.4.1 to 1.4.2:

          protected int getOffset() {
              int offset = ((getCurrentPage()) * maxResultsPerPage) -1;
              if(offset > count) {
                  int pages = count / maxResultsPerPage;
                  offset = pages * maxResultsPerPage;
              }
              return offset;
          }
      

      should be

          protected int getOffset() {
              int offset = (getCurrentPage() - 1) * maxResultsPerPage;
              if(offset > count) {
                  int pages = count / maxResultsPerPage;
                  offset = pages * maxResultsPerPage;
              }
              return offset;
          }
      

        Acceptance criteria

              ochytil Ondrej Chytil
              frank.rittinger Frank Rittinger
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: