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

feat(pagination): add event for firing when amount of pages decreases (now pageChanged event is fired) #2175

Open
christianlundberg opened this issue Jul 6, 2017 · 4 comments

Comments

@christianlundberg
Copy link

I am using async data and thus I use pageChanged to send a request and get a new page of data. The problem is that when filtering, the amount of pages can obviously decrease and the current page is set to the last page. Now I can understand the logic behind this, but the problem is that it is set to the last page even if the current page is less than the amount of pages. It should only be set to the last page if the current page is actually greater than the amount of pages.

Another thing is that you should be allowed to decide if it should be set to the first or last page. And when automatically setting the current page because the amount of pages changed, the event fired should probably be a different one. I don't like that pageChanged is fired just because the pages shrunk.

@valorkin
Copy link
Member

it is a pretty common situation I suppose,
just thinking loun:

  1. filter changed
  2. items updated
  3. paging updated

idea: need to mark initial page change
changing current event will be a breaking change

@kenken64
Copy link

Hi,

I am encountering this problem as well please see the kitchen sink app that we wrote using the pagination

https://github.com/Block5d/block5d-kitchen-sink/blob/master/src/app/search-user/search-user.component.ts

@jongunter
Copy link

I'm encountering this problem, too. I'm storing my search results in ngrx/store and loading results with fewer pages results in a chain of actions like FETCH_RESULTS_SUCCESS => CHANGE_PAGE => FETCH_RESULTS => FETCH_RESULTS_SUCCESS. This results in duplicate API requests, as well as ExpressionChangedAfterItHasBeenCheckedErrors. It's cumbersome to work around.

@YevheniiaMazur YevheniiaMazur changed the title Pagination: (pageChanged) event fired when amount of pages decreases feat(pagination): add event for firing when amount of pages decreases (now pageChanged event is fired) Jan 15, 2018
@abhandari24
Copy link

I am facing the same issue, I have created our custom component around ngx-bootstrap pagination component, which sets the itemsPerPage and it has its own event but the pagechanged event is firing irrespective of that. And I dont want to come back to last page after page changed instead to first. Please if anyone can help with the workaround that. Thanks

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

No branches or pull requests

8 participants