Datatables scroll to top when clicking pagination


Topic: Datatables scroll to top when clicking pagination

BWBama85 asked 6 years ago

On this page I'd like to scroll to the top when you click each of the pagination links https://www.bamapolitics.com/alabama/alabama-government-officials/profiles/

None of the stackoverflow or Google results have been working for me.


Bartłomiej Malanowski staff pro premium answered 6 years ago

Have you tried this? This seems to work fine


BWBama85 commented 6 years ago

I had not. Thanks, it worked perfectly.


Shubham mt commented 4 years ago

I have to use this same in angular 9 is there any possible solution for this.

Thanks


Arkadiusz Idzikowski staff commented 4 years ago

@Shubham mt if you use our table pagination component, you can listen to click events, for example: (nextPageClick) or (previousPageClick).

Further implementation should be similar to the one from the jQ version. You need to find the offsetTop of the table element, and use window.scrollTo(0, tableOffsetTop) to scroll to the top of the table.

In case of any further problems, please create a new thread in Angular section and provide an example code.


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.7.3
  • Device: Desktop
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: Yes
Tags