Closed 5inline closed 9 years ago
there is: check out fa-index On Oct 24, 2014 3:35 PM, "5 Inline" notifications@github.com wrote:
In an fa-scroll-view or fa-sequential-view with an ng-repeat inside, any items added to the ng-repeat array after render appear at the bottom, regardless of the sorting options in ng-repeat.
{{item.name}} // List of items $scope.items = [ {name: 'Albert'}, {name: 'Roger'}, {name: 'Bob'}, {name: 'Steve'} ];
// Execute after initial render setTimeout( function() { $scope.items.push({name:'Aaron'}); }, 1500);
On the initial load, the items will appear in the correct order. After that, 'Aaron' is always added to the bottom of the list.
Is there a way to retain the sorting when items are added after the initial render?
— Reply to this email directly or view it on GitHub https://github.com/Famous/famous-angular/issues/242.
Awesome. That works for fa-scroll-view.
Does not work for fa-sequential-view, though not sure if it is intended to.
fa-index works on fa-sequential-view, and will work for fa-deck as well. Please see https://github.com/Famous/famous-angular/issues/236#issuecomment-59635947
This was a bug: if dynamic values are bound to fa-index (instead of constants like in the example you shared, @imheresamir ) then in some cases sorting wouldn't work because the directive would try to sort the values before they had been evaluated by Angular. There was a fix in place for this in fa-scrollview but it hadn't made it to fa-sequential-layout yet: just fixed this with 57e4b8d1b5143 . @5inline, if you try pulling down master, is this fixed for you?
Ahh gotcha. Thanks for clearing that up.
Yep, that fixes it. Thanks for the quick turnaround!
In an fa-scroll-view or fa-sequential-view with an ng-repeat inside, any items added to the ng-repeat array after render appear at the bottom, regardless of the sorting options in ng-repeat.
On the initial load, the items will appear in the correct order. After that, 'Aaron' is always added to the bottom of the list.
Is there a way to retain the sorting when items are added after the initial render?