Calling ModelArray#filter should return a FilteredModelArray #78

Closed
pixelcort opened this Issue Feb 2, 2012 · 6 comments

Comments

Projects
None yet
5 participants
@pixelcort

When calling a ModelArray instance's filter method, it should return a FilteredModelArray with the results. When the contents of the model array update, either by new model instances entering/leaving the model array or the contents of those models changing, the filtered model array should be updated accordingly.

@devinus

This comment has been minimized.

Show comment
Hide comment
@devinus

devinus Feb 2, 2012

Member

"Smart queries"

Member

devinus commented Feb 2, 2012

"Smart queries"

@ebryn ebryn closed this Feb 16, 2012

@ebryn ebryn reopened this Feb 16, 2012

@ebryn

This comment has been minimized.

Show comment
Hide comment
@ebryn

ebryn Feb 16, 2012

Member

Oops, accidently closed.

Member

ebryn commented Feb 16, 2012

Oops, accidently closed.

@wycats

This comment has been minimized.

Show comment
Hide comment
@wycats

wycats Feb 26, 2012

Member

So what you're requesting is something like this:

var toms = Person.filter(function(data) {
  if (data.get('name').test(/tom/i)) { return true; }
});

var marriedToms = filter.filter(function(data) {
  if (data.get('isMarried') === true) { return true; }
});

And it would work on other kinds of ModelArrays, like associations or findAll results, right?

I should note that for findAll results you could just do a regular filter.

Member

wycats commented Feb 26, 2012

So what you're requesting is something like this:

var toms = Person.filter(function(data) {
  if (data.get('name').test(/tom/i)) { return true; }
});

var marriedToms = filter.filter(function(data) {
  if (data.get('isMarried') === true) { return true; }
});

And it would work on other kinds of ModelArrays, like associations or findAll results, right?

I should note that for findAll results you could just do a regular filter.

@pixelcort

This comment has been minimized.

Show comment
Hide comment
@pixelcort

pixelcort Feb 27, 2012

@wycats yep; preferably on any instance DS.ModelArray or its subclasses.

@wycats yep; preferably on any instance DS.ModelArray or its subclasses.

@wycats

This comment has been minimized.

Show comment
Hide comment
@wycats

wycats Aug 10, 2013

Member

This seems reasonable and useful.

Member

wycats commented Aug 10, 2013

This seems reasonable and useful.

@ghost ghost assigned wycats Aug 10, 2013

@tomdale

This comment has been minimized.

Show comment
Hide comment
@tomdale

tomdale Nov 7, 2013

Member

We still want this as a feature, but it's out of scope for the 1.0 release. Soon, we'll be adding feature flag infrastructure à la Ember proper. I'm going to close the issue, but once feature flags are in, we'd love a PR for this feature behind a flag.

Member

tomdale commented Nov 7, 2013

We still want this as a feature, but it's out of scope for the 1.0 release. Soon, we'll be adding feature flag infrastructure à la Ember proper. I'm going to close the issue, but once feature flags are in, we'd love a PR for this feature behind a flag.

@tomdale tomdale closed this Nov 7, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment