On Coming Back from Details to List Page the scroll position goes back on top - List Data Loaded by Async task

I have noticed that the issue of maintaining the Scroll position after coming back from the details page is fixed & it’s working fine.

But say I am loading the list data in a async process (most of the time, it will be) then the above functionality is broken & the list is going back on top.

For demonstrating

With the same example if I just return the result without any Async task , it works perfectly.
Now how to do that with the Async Case ?



Interesting point. I set up a sample that shows scroll position is retained when using synchronous code.

@andytjoslin or @adam You have suggestions on how to maintain scroll position when the list scope is reloaded?

I hope someone or Ionic develop team will answer how to fix this async task soon. It’s really annoying!
Thank you!

1 Like

FYI : Have opened GitHub Issue # 719 on this topic : https://github.com/driftyco/ionic/issues/719

is that resolved yet in beta1? i couldnt tell its status from issue #719.

The way, I am solving this issue is putting a check in the service to find if the Array is already populated (this will be the case if we are coming back to this page by pressing ‘Back’) & returning the already filled Array. This way there is no delay & the list can able to remember the scroll position.

Thanks Sat for your reply here.
Just to get this right, are you caching the array so that when you nagivate away and then navigate back you populate the list from the cached array instead of calling the service again?

exactly @michelhabib doing that only.

1 Like

It is very important to add this in the documentation!

If you are using the latest Beta 14, this might not really necessary. With the new cached views, you will come back to the page without actually re-initializing the controller. So, the old data will be there and scrolled to the previous position.

1 Like

Nice, I will try it!

Forewarned : Beta 14 is VERY different from Beta 13. You’re going to have to do a bit ( or a lot) of refactoring.

1 Like

any ideas about to implement this on Ionic 3?