ember.js - can I change rest model state without using .set() -
i have model custom attribute(array of objects). this
app.adapter.registertransform('images', { serialize: function(value) { var ret = [] value.foreach(function(img){ ret.pushobject(img.get('uuid')) }) if (ret.get('length')) { return ret.join(',') } else return false }, deserialize: function(value) { ret = [] if (typeof value !== 'undefined') { uuids = value.split(',') (var = 0; < uuids.length; i++) { var id = uuids[i] ret.pushobject( app.image.create({'uuid': id}) ) } } return ret } }) and model.
app.item = ds.model.extend({ … images: ds.attr('images') }) in controller need commit data, after pushing changes in property. need case?
uploadimage: function(){ var self = uploading.done(function(result) { self.get('images').pushobject(app.image.create({uuid:result.uuid})) console.log(self.get('isdirty')) // false self.get('store').commit() //nothing change }).fail(function(result) { … }).always(function() { … }) },
have tried this?
self.notifypropertychange('images');
Comments
Post a Comment