Famous / famous-angular

Bring structure to your Famo.us apps with the power of AngularJS. Famo.us/Angular integrates seamlessly with existing Angular and Famo.us apps.
https://famo.us/angular
Mozilla Public License 2.0
1.92k stars 275 forks source link

orderBy not working on fa-scroll-view #273

Closed stukennedy closed 9 years ago

stukennedy commented 9 years ago

the orderBy filter works on an ng-repeat applied to an fa-view within an fa-scroll-view only when it is initialised ... any updates to the repeated array that would normally result in an updated order have no effect.

<fa-scroll-view fa-pipe-from="myEventHandler" fa-options="options.myScrollView">
            <fa-view ng-repeat="download in (filtered = (downloads | orderBy: 'order'))">
                <fa-surface fa-size="[400, 110]" fa-z-index='50' fa-pipe-to="myEventHandler">
                </fa-surface>
           </fa-view>
</fa-scroll-view>
stukennedy commented 9 years ago

Here's a codio example of what I'm encountering https://codio.com/continuata/fa-scroll-view-ordering ... I've commented out a non-F/A div version of the ordering where you can see it working as it should.

Does anyone know how I can force the fa-scroll-view to get its order to update without refreshing the page?

zackbrown commented 9 years ago

Hey @continuata — the function for updating F/A's scrollview ordering is exposed via isolate.updateMethod — BUT I believe your problem can be fixed more simply and robustly by using fa-index. It looks like filter-based sorting won't trigger F/A's update mechanism—unless you explicitly add an fa-index attribute to the same element you're ng-repeating.

Does that work for you?

stukennedy commented 9 years ago

Hi @zackbrown ... Haha - perfect!! Thanks so much. That was really getting me down. I just set fa-index="$index" on the repeated element and that did it.