cancel
Showing results for 
Search instead for 
Did you mean: 

Scroll back a table to the top

Former Member
0 Kudos

Hello,

This seems quite simple but I'm unable to make it work.

I have a view where a table is displayed in a SAPUI5 application where I navigate with the routing mechanism defined in manifest.json.

I navigate from this view to a detail view and then navigate back with the browser's back button (it is not a button inside the application).

My problem comes when I scroll down in the page and come back. The scroll position is maintained so the view mantains the scroll position and doesn't go back to the top when I navigate back.

I'm using a sap.m.Page and in the latest API reference I can see the scrollTo(y, time) method in it but it doesn't seem to work for me. Maybe because the back is clicked in the browser? Anyone else has faced this kind of issue?

Thank you very much for you time in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

saivellanki
Active Contributor
0 Kudos

Hi Ibai,

Are you using routing mechanism for navigation? If so, you can place this code on page 'navButtonPress' event:


var oPage = this.getView().byId("oPage");     //Get Hold of page

oPage.scrollTo(0,0);     //Page scroll to top

A similar kind of sample: Plunker

Snip:


Regards,

Sai Vellanki.