Skip to content

could the result of a server query be mutable? #370

ppcano opened this Issue Aug 24, 2012 · 5 comments

4 participants

ppcano commented Aug 24, 2012

I am facing many times with this issue, which seems to be a common situation when client request to paginated/offset resources.

    var content = this.get('content');
    models =, {limit: 3, offset: 3, xxxxxx});
    models.addObserver('isLoaded', function() {
        if (!!content) {
        } else {
           this.set('content', models);

A solution/workaround is to create a mutable array as documented on this stackoverflow post.

I don't know if it could be possible/suitable to improve the result query to be mutable.

Ember.js member
tchak commented Aug 25, 2012

You should do pagination with an ArrayController not directly on an AdapterPopulatedRecordArray.

@wagenet wagenet closed this Oct 16, 2012
Ember.js member
wagenet commented Oct 16, 2012

If @tchak's suggestion doesn't work for you, let us know.


I'm sorry, I'm not sure what you mean with your suggestion? Likewise, I'm trying to append some objects to an ArrayController that was created with data from Ember Data and I get the same error when I call addObjects:

The linked stackoverflow post above gets around this by having a member variable shadow the "real" content attribute, which feels like it should be an unnecessary hack.

Ember.js member
wagenet commented Nov 16, 2012

@ppcano, JohnEmhoff the issue is that the results of a find is not a standard array. If you want to manipulate it as a standard array, you should use toArray() once the initial results are loaded.


Thanks, that's a little cleaner.

@benkonrath benkonrath referenced this issue in onepercentclub/onepercentclub-site Jan 11, 2013

Properly add wallpost to top of list. #162

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.