ListView scroll up on list filter change


#1

I have a ListView on a page working fine. I also have a list picker with categories above the list. When you select a category I have a changeEvent fire that filters the list. All of that works. However, if the list was scrolled up on a previous view, then filtered, I would like the list to scroll up. I have found the method used to programmatically scroll the list, but I cannot seem to figure out how to call it after the list filters. The android portion of this code works, but not the ios.

scrollList() {

        this._listView = <ListView>this.page.getViewById("classlistview");   
        if (this._listView.android) {
            this._listView.android.smoothScrollToPosition(0);
         }
         else {
             this._listView.scrollToIndex(0);
         }
    }

Any idea how I would get that to work?


#2

Simply use this. _listView.scrollToIndex(0) to scroll list to top.


#3

I know that, but how do I fire it after the filter event? Or can I do a check for a change event on the list?


#4

Simply call the function or fireEvent, until seeing the code can’t say much on how.