Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client side pagination and itemsPerPage #138

Closed
seminull opened this issue May 27, 2015 · 11 comments
Closed

Client side pagination and itemsPerPage #138

seminull opened this issue May 27, 2015 · 11 comments
Assignees
Labels
Milestone

Comments

@seminull
Copy link

I was curious as to why in setRemainingRange and setPreviousRange functions that itemsPerPage were even used at all when it comes to incrementing and decrementing whole 'pages'? This caused the page.remaning() and page.previous() buttons to not work as expected.

@Zizzamia
Copy link
Owner

Can you please show me some code where this error happen.

@seminull
Copy link
Author

It took some time to reproduce it from scratch but I found the culprit or at least better information.

<div tasty-pagination items-per-page="25"></div>

http://www.seminull.com/angular/ngtasty/#/

@deandavison2
Copy link
Contributor

This problem is not only client side, but also a problem for server side pagination. Basically the code below leads to the page buttons acting like you are at the end of the list of page numbers before you actually are. You can see it on the project's example site. You can't get 7 to show in the pagination when clicking the next pages arrows.

setRemainingRange = function () {
  if (scope.pagHideMaxRange === true || scope.pagMaxRange > scope.pagination.pages) {
    return false;
  }
  scope.pagMinRange = scope.pagMaxRange;
  scope.pagMaxRange = scope.pagMinRange + scope.itemsPerPage;
  if (scope.pagMaxRange > scope.pagination.pages) {
    scope.pagMaxRange = scope.pagination.pages;
  }
  scope.pagMinRange = scope.pagMaxRange - scope.itemsPerPage;
  setPaginationRanges();
};

@seminull
Copy link
Author

@ddavison732 that's slightly different than the problem I'm describing here, but I know what you are referring to. I have a PR out for it, as soon as I can figure out unit tests in JS. :)

@deandavison2
Copy link
Contributor

Ok, sorry for the confusion.

@Zizzamia
Copy link
Owner

The range pagination is not working in a couple of case. I try to use your PR @seminull but is not enough to cover all the two case where there is the errors, and also is not passing the old tests.
I'm going tomorrow try to come out with a more stable fix.
ThankYou both to help me focus on this problem. :)

@Zizzamia Zizzamia added this to the Version 0.5.5 milestone May 31, 2015
@Zizzamia Zizzamia self-assigned this May 31, 2015
Zizzamia added a commit that referenced this issue Jun 3, 2015
@Zizzamia
Copy link
Owner

Zizzamia commented Jun 3, 2015

So, was not so simple find the time to do this fix,
but in the end by your helps I made the commit that fix this bug.
ThankYou for the help and all the information you share with me.

@Zizzamia Zizzamia closed this as completed Jun 3, 2015
@seminull
Copy link
Author

seminull commented Jun 3, 2015

Thanks @Zizzamia you're awesome!

@deandavison2
Copy link
Contributor

I haven't downloaded the changes yet but thanks for maintaining this awesome project.

@Zizzamia
Copy link
Owner

Zizzamia commented Jun 4, 2015

The change will be up on the next release. I'm sorry for the delay but it's been few busy weeks in Twitter.

@Zizzamia
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants