Get an index of the iterated element on DS.FilteredRecordArray #297

Closed
josepjaume opened this Issue Jun 21, 2012 · 2 comments

Projects

None yet

3 participants

@josepjaume

I don't know if this makes sense, but it would be useful to have the iterated element's index on App.store.filter(). This would allow paginating results in a view, for example.

In my case, I found out the need when I had to put the "even" elements in a place, and the "odd" ones in another. I ended up having to use the clientId because is nearly sequencial and it kinda worked, but it's totally wrong.

As an example, if we had the index we could:

var oldPeople = App.store.filter(App.Person, function(data, index) {
    var nextPage = pageNumber + 1;
    if (index > (pageNumber*10) && index < nextPage*10) { return true; }
});

What do you think about it?

@sly7-7
Collaborator
sly7-7 commented May 13, 2013

@josepjaume What's the status of this ? Is this always a need ? Did you find an other workaround ?

@wagenet
Member
wagenet commented Aug 9, 2013

This seems odd to me. However, we might accept a PR if there was a strong use case for it.

@wagenet wagenet closed this Aug 9, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment