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

pagination inside scrolleable div makes browser window scrolleable #359

Open
AndesCode opened this issue May 17, 2020 · 2 comments
Open

Comments

@AndesCode
Copy link

Hi.

Im experimenting a rare bug when i use the ngx-pagination inside a scrolleable div

I've reproduced the same error that i have in my code in the example stackblitz of this project writing the following code in the .html (replace the stackblitz app.component.html content for the next one )

<div style="height: 40vh; overflow: auto;"> <!--scrolleable div-->
<div style="height: 140vh;">bunch of content</div> <!--div simulating bunch of elements-->
<div class="text-center">
	<h1>ngx-pagination live demo</h1>
	<h4><small><a href="https://github.com/michaelbromley/ngx-pagination">GitHub Repo</a></small></h4>
	<p>A bare-bones demo for your experimenting / bug-reproducing pleasure.</p>
</div>
<div class="list">
		<ul>
			<li *ngFor="let item of collection | paginate: { itemsPerPage: 10, currentPage: p }">{{ item }}</li>
		</ul>

		<pagination-controls (pageChange)="p = $event"></pagination-controls>
</div>
</div>

It only happen when the scrolleable div have a ngx-paginator AND the scrolleable div have a important number of items inside that in this case is simulating by "bunch of content" (if you reduce bunch of content div vh the error dissapear but in my code i have a lot of stuff to show right there)

As you can see, this make the main browser window scrolleable for some reason.

This is by far the best paginator of angular and I hope this could have a solution :(

Thanks!

@michaelbromley
Copy link
Owner

Hi,

thanks for the report and the reproduction. It's really weird, I can't figure out why it does that. A solution you can use is to create your own pagination controls template as demonstrated here: https://michaelbromley.github.io/ngx-pagination/#/custom-template

This seems to fix the issue for me.

@AndesCode
Copy link
Author

I will try your solution as soon as I can, thanks for your answer!!

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

No branches or pull requests

2 participants