Multiple DataRepeaters with individual filter/sort of a collection?

I see that we can apply a filter to a Collection, but is there a way to filter/sort the collection as its applied to different DataRepeaters? I assume applying a filter will change the collection rendering in all DataRepeaters, but I'd like different views of the collection for each DataRepeater.

For example if my app has a collection of "Books", and each Book model has a property of "read", and I'd like, in a single view, to show one DataRepeater with all the "read" books, and the second DataRepeater show all the "unread" books. So when I toggle the "currentlyreading" property of any book in the collection, I could highlight that book in either list.

A similar case could be with two side-by-side lists of my books, one list ordered by "name" and the other ordered by "pages", both representing the same data.


Is there a way to have multiple collections as views on the same set of models, or do I need to manually keep them all in sync, or maybe I'm just missing some better way of managing this ... ?

Comments

  • If I understand things correctly, you should be able to filter the Collection in the DataRepeater just fine as long as the connection between that and the initial collection is one way towards the repeater.

    For instance:

    this.collection ---> this.$.dr.collection
    |
    --------> this.$.dr2.collection

    if you change this.collection, all of them should change. However, if you change this.$.dr.collection, only this.$.dr.collection changes.

    At least, that's the way I understand it. I'm still new to the Enyo MVC model.
Sign In or Register to comment.