jmorrell / backbone.obscura

A read-only proxy of a Backbone.Collection that can be filtered, sorted, and paginated.
http://jmorrell.github.io/backbone.obscura/
MIT License
107 stars 19 forks source link

Add models on proxy #2

Closed mulderp closed 10 years ago

mulderp commented 11 years ago

When calling:

 proxy.models

There is "undefined" returned.

So, in case of rendering a collection from a proxy that requires models instead of JSON, having models would make the proxy more complete.

jmorrell commented 11 years ago

This is something that needs to be solved in the backbone-collection-proxy module that I build off of. I created an issue over there, and will be exploring solving the problem there.

If the reference to Collection.models never changes (backbone is always modifying one array instance) as I suspect, then it should be a matter of just adding a reference to the .models of the proxied collection. I need to think through the change and make sure it doesn't have any adverse effects though.

jmorrell commented 10 years ago

This feature was added with this commit: https://github.com/jmorrell/backbone.obscura/commit/ff3456eed72a5900de807a2fca4fdac761b6f04a :squirrel:

The main issue was making sure that the reference was updated when the original collection was reset.

If you run into any issues, please let me know.