ember-model

Difference between model.save() versus model.get('store').commit()

女生的网名这么多〃 提交于 2019-11-30 13:06:59
What is the difference between // 'this' is the controller this.get('model').save(); and // 'this' is the controller this.get('model').get('store').commit(); ? Of the little testing I did, they both gave me the same results. Which one should I use? I looked into the first one, and it calls DS.Model = Ember.Object.extend( ... save: function() { this.get('store').scheduleSave(this); var promise = new Ember.RSVP.Promise(); this.one('didCommit', this, function() { promise.resolve(this); }); return promise; }, So the question then becomes, what's the main difference between this.get('store')

Ember-table integration with Ember-model / Ember-data

自古美人都是妖i 提交于 2019-11-30 03:54:19
I am trying to link ember-models to the ember-table to pull paginated records from the server and add them to the table when scrolling down. I can get it working by just requesting my api url with page number like in the ajax example on http://addepar.github.io/ember-table/ but i cant figure out how to integrate it with ember-model to create and ember objects and then add them to the table. Here is my code to just make an ajax request and add to table. Can anyone tell me how i can change this to use ember-model / ember-data instead. App.TableAjaxExample = Ember.Namespace.create() App

Difference between model.save() versus model.get('store').commit()

时光毁灭记忆、已成空白 提交于 2019-11-29 18:18:50
问题 What is the difference between // 'this' is the controller this.get('model').save(); and // 'this' is the controller this.get('model').get('store').commit(); ? Of the little testing I did, they both gave me the same results. Which one should I use? I looked into the first one, and it calls DS.Model = Ember.Object.extend( ... save: function() { this.get('store').scheduleSave(this); var promise = new Ember.RSVP.Promise(); this.one('didCommit', this, function() { promise.resolve(this); });

Ember-table integration with Ember-model / Ember-data

爱⌒轻易说出口 提交于 2019-11-29 00:49:13
问题 I am trying to link ember-models to the ember-table to pull paginated records from the server and add them to the table when scrolling down. I can get it working by just requesting my api url with page number like in the ajax example on http://addepar.github.io/ember-table/ but i cant figure out how to integrate it with ember-model to create and ember objects and then add them to the table. Here is my code to just make an ajax request and add to table. Can anyone tell me how i can change this