Ion-list slow to refresh


#1

Is there any way to use faster list refresh? My problem is, that i change items in list view and it takes a second (usualy when the scroller bar disapears) to refresh. If I scroll before scroller bar disapears i dont get full new list. For example. I have list of 20 items and then i change it to 40…if I scroll before the scroller bar disapears, i would get only 20 cells. Then if i wait for like a second, the list view will correclty set itself to 40 cells/items.
Any idea what to do?


#2

I’m not sure if I understand this correctly, but maybe $ionicScrollDelegate.resize() is what you need? If your problem is resizing the window, that will fix it.


#3

Sorry for my poor English. Basicly, my problem is that I’m creating dynamic side-menu. When you click on parent-menu item, it will populate side-menu list with child items. Problem is that side-menu size takes like a second to adjust to new number of elements in side-menu.
My code looks basicly like this:

<ion-item nav-clear ng-repeat="item in menuItems"  id="{{item.id}}">
                        {{item.title}}
 </ion-item>  

In controller my $scope is populated like this:

$scope.menuItems = [];
$scope.menuItems.length = 0; // If there are any items in before, delete them
// here I populate $scope and it shows in side-menu with new items
$scope.menuItems = customersFactory.getMenuItems(); // Calls factory functions that returns child items for side-menu

#4

Okay, so I’ve created a codepen that I think is doing what you’ve said. The first set of items has 20 elements in it. When you click on “Change Menu Items” it changes that item set to have 40 elements. After changing the items I call $ionicScrollDelegate.resize() which is adjusting the scrollbar to fit the new amount of elements. If you comment this line out you can see the window takes a few seconds to adjust to the new elements: Codepen.


#5

Wow, thank you very much. That solved my problem 100% :). Thank you very much.