creativetimofficial / ct-now-ui-dashboard-pro-react

React version of Now UI Dashboard PRO
23 stars 5 forks source link

Scroll mainPanel to the top after change page... #10

Closed kzeman closed 4 years ago

kzeman commented 6 years ago

It happens, that if you scroll selected page to the bottom and switch to another page, then the position of the newly selected page remains. It would be better after selecting another page it will show from top position.

einazare commented 6 years ago

Hello @kzeman ,

Yes, it would be best for this behavior to happen. I've added a note for this issue, on my next update i'm going to make it happen.

Best, Manu.

kzeman commented 6 years ago

Hello again @kzeman ,

Here is the sample code:

componentDidUpdate(e) { if (e.history.location.pathname !== e.location.pathname) { this.refs.mainPanel.scrollTop = 0; } } Best, Manu

That works!

bertha22 commented 6 years ago

when i run, it pops up "e.history" is undefined, how did you solve this problem?

einazare commented 6 years ago

Hello @bertha22 ,

Thank you for your interest in using our product and sorry for this late response (i've been on a small vacation - next week i also be on vacation). Have you changed something to out product?

Best, Manu