在Ember Js中使用本地存储适配器删除记录

时间:2013-09-21 06:50:40

标签: ember.js ember-data

即时使用LSA作为我的adapter.i可以使用此适配器创建记录,但我不知道如何使用此适配器删除或更新记录。当我使用

deleteDragFromModel:function(item){
  var item = this.get('store').deleteRecord('axisModel',item);
  item.save();
}

我得到一个错误说:

Uncaught TypeError: Object axisModel has no method 'deleteRecord' ember-data.js:1388

如果我console.log(item)结果是:

Class {name: "Cube1-1", caption: "Cube1-1", dimensionUniqueName: "NA", description: 
   "Cube1-1", levelUniqueName: "NA"…}
   __ember1379749368210: "ember743"
   __ember1379749368210_meta: Meta
  _super: undefined
  calculated: false
  caption: "Cube1-1"
  description: "Cube1-1"
  dimensionUniqueName: "NA"
  get uniqueName: function () {
  hierarchyUniqueName: "NA"
  levelUniqueName: "NA"
  name: "Cube1-1"
  set uniqueName: function (value) {
  toString: function () { return ret; }
  __proto__: Object 

1 个答案:

答案 0 :(得分:1)

以下不起作用吗?

deleteDragFromModel: function(item){
  item.deleteRecord();
  item.save();
}