Ember数据:删除记录而不在提交前将其从视图中删除

时间:2013-06-06 03:19:05

标签: ember.js ember-data

采取以下措施:

FooController = Ember.ObjectController.extend
  # Model is set, view is rendered, button is clicked
  someDeleteAction: ->
    # Object is destroyed & removed from view
    @get('content').deleteRecord();

    # Uh-oh... error happens here, but object
    # remains 'deleted' according to ember 
    @get('content.transaction').commit();

有没有办法防止对象被破坏并从视图中删除?

奖励积分:中国水刑的1级...... ember-data多少有趣?

1 个答案:

答案 0 :(得分:0)

我的解决方案:

覆盖DS.Model.deleteRecord,使其先与服务器联系,然后commit进行交易。