Reputation: 2361
I have made simple CRUD program here.
But on click of delete (here i am trying to delete first record of model) it is not deleting any record,it is throwing error
Uncaught TypeError: Object function () {..} has no method 'deleteRecord'
Can anyone help me to solve this issue i am struggling on this issue from last 2 days? I have posted my code here.
I have edited my fiddle to add functionality of create record (here) It is adding blank records in table. Can anyone tell me how to add/create record in this case?
savecontact: function(){
App.Person.createRecord({
fname: this.get('firstName'),
lname: this.get('lastName'),
contactype: 1
});
this.get('store').commit();
},
Upvotes: 1
Views: 697
Reputation: 23322
Basically this line is what changed:
this.get('store').deleteRecord(App.Person.find(1));
You where calling deleteRecord
on a class definition App.Person
which of course throws an error.
See working jsfiddle here.
Hope it helps.
Upvotes: 1