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

**URL:** <https://forum.ionicframework.com/t/on-coming-back-from-details-to-list-page-the-scroll-position-goes-back-on-top-list-data-loaded-by-async-task/1432>\
**Category:** ionic-v1\
**Created:** [February 27, 2014, 12:36pm UTC](https://forum.ionicframework.com/t/on-coming-back-from-details-to-list-page-the-scroll-position-goes-back-on-top-list-data-loaded-by-async-task/1432 "2014-02-27T12:36:23Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sat](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@Sat](https://forum.ionicframework.com/u/Sat)\
**Post date:** [February 27, 2014, 12:36pm UTC](https://forum.ionicframework.com/t/on-coming-back-from-details-to-list-page-the-scroll-position-goes-back-on-top-list-data-loaded-by-async-task/1432/1 "2014-02-27T12:36:23Z")

</div>

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  
https://codepen.io/SatadruBhattacharjee/embed/preview/jsLtb?height=300&slug-hash=jsLtb&default-tabs=js,result&host=https://codepen.io

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 ?

Regards,  
Sat

---

<div class="post-metadata">

**Author:** ![Calendee](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/calendee/32/13656_2.png) [@Calendee](https://forum.ionicframework.com/u/Calendee)\
**Post date:** [February 27, 2014, 2:10pm UTC](https://forum.ionicframework.com/t/on-coming-back-from-details-to-list-page-the-scroll-position-goes-back-on-top-list-data-loaded-by-async-task/1432/2 "2014-02-27T14:10:33Z")

</div>

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

https://codepen.io/calendee/embed/preview/zLobr?height=300&slug-hash=zLobr&default-tabs=js,result&host=https://codepen.io

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

---

<div class="post-metadata">

**Author:** ![shinaekwon2n](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@shinaekwon2n](https://forum.ionicframework.com/u/shinaekwon2n)\
**Post date:** [February 28, 2014, 9:47am UTC](https://forum.ionicframework.com/t/on-coming-back-from-details-to-list-page-the-scroll-position-goes-back-on-top-list-data-loaded-by-async-task/1432/3 "2014-02-28T09:47:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Calendee](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/calendee/32/13656_2.png) [@Calendee](https://forum.ionicframework.com/u/Calendee)\
**Post date:** [March 4, 2014, 12:43pm UTC](https://forum.ionicframework.com/t/on-coming-back-from-details-to-list-page-the-scroll-position-goes-back-on-top-list-data-loaded-by-async-task/1432/4 "2014-03-04T12:43:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![michelhabib](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@michelhabib](https://forum.ionicframework.com/u/michelhabib)\
**Post date:** [April 25, 2014, 3:01pm UTC](https://forum.ionicframework.com/t/on-coming-back-from-details-to-list-page-the-scroll-position-goes-back-on-top-list-data-loaded-by-async-task/1432/5 "2014-04-25T15:01:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sat](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@Sat](https://forum.ionicframework.com/u/Sat)\
**Post date:** [June 25, 2014, 8:56am UTC](https://forum.ionicframework.com/t/on-coming-back-from-details-to-list-page-the-scroll-position-goes-back-on-top-list-data-loaded-by-async-task/1432/6 "2014-06-25T08:56:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![michelhabib](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@michelhabib](https://forum.ionicframework.com/u/michelhabib)\
**Post date:** [August 24, 2014, 11:03am UTC](https://forum.ionicframework.com/t/on-coming-back-from-details-to-list-page-the-scroll-position-goes-back-on-top-list-data-loaded-by-async-task/1432/7 "2014-08-24T11:03:57Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Sat](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@Sat](https://forum.ionicframework.com/u/Sat)\
**Post date:** [August 24, 2014, 11:15am UTC](https://forum.ionicframework.com/t/on-coming-back-from-details-to-list-page-the-scroll-position-goes-back-on-top-list-data-loaded-by-async-task/1432/8 "2014-08-24T11:15:15Z")

</div>

exactly @michelhabib doing that only.

---

<div class="post-metadata">

**Author:** ![danicomas](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/danicomas/32/100310_2.png) [@danicomas](https://forum.ionicframework.com/u/danicomas)\
**Post date:** [December 19, 2014, 9:10am UTC](https://forum.ionicframework.com/t/on-coming-back-from-details-to-list-page-the-scroll-position-goes-back-on-top-list-data-loaded-by-async-task/1432/9 "2014-12-19T09:10:00Z")

</div>

It is very important to add this in the documentation!

---

<div class="post-metadata">

**Author:** ![Calendee](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/calendee/32/13656_2.png) [@Calendee](https://forum.ionicframework.com/u/Calendee)\
**Post date:** [December 19, 2014, 10:59am UTC](https://forum.ionicframework.com/t/on-coming-back-from-details-to-list-page-the-scroll-position-goes-back-on-top-list-data-loaded-by-async-task/1432/10 "2014-12-19T10:59:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![danicomas](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/danicomas/32/100310_2.png) [@danicomas](https://forum.ionicframework.com/u/danicomas)\
**Post date:** [December 19, 2014, 11:03am UTC](https://forum.ionicframework.com/t/on-coming-back-from-details-to-list-page-the-scroll-position-goes-back-on-top-list-data-loaded-by-async-task/1432/11 "2014-12-19T11:03:54Z")

</div>

Nice, I will try it!

---

<div class="post-metadata">

**Author:** ![Calendee](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/calendee/32/13656_2.png) [@Calendee](https://forum.ionicframework.com/u/Calendee)\
**Post date:** [December 19, 2014, 11:07am UTC](https://forum.ionicframework.com/t/on-coming-back-from-details-to-list-page-the-scroll-position-goes-back-on-top-list-data-loaded-by-async-task/1432/12 "2014-12-19T11:07:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Xiwi](https://avatars.discourse-cdn.com/v4/letter/x/58f4c7/32.png) [@Xiwi](https://forum.ionicframework.com/u/Xiwi)\
**Post date:** [May 28, 2018, 11:20am UTC](https://forum.ionicframework.com/t/on-coming-back-from-details-to-list-page-the-scroll-position-goes-back-on-top-list-data-loaded-by-async-task/1432/13 "2018-05-28T11:20:05Z")

</div>

> [@Calendee](#):
>
> e.

any ideas about to implement this on Ionic 3?
