ember.js - Ember js, get next item in model? -


is there way next item in model in ember.js?

something like:

var nextobjectafteridone = this.store.getbyid(app.model, '1').get('nextobject') 

i came across answer seems bit hacky, , ids in application aren't sequential, , items ordered different attribute.

any ideas?

i'm not sure it's way @ least should work. try iterate on list of item , once find current id, next iteration give next item.

var list = this.store.all(app.model); var id = 2; var found = false; var itemfound = undefined; list.foreach(function(item, i) {     if (found) {         itemfound = item;         return true;     }     if (item.get('id') == id) found = true; }); 

this has not been tested can try it.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -