I'm new to Sencha Touch and I'm having problems to delete a record.
This is my model:
Ext.define('MyApp.model.Customer', {
extend: 'Ext.data.Model',
...
config: {
idProperty: 'key',
fields: [
{
name: 'key',
type: 'auto'
},
{
name: 'name',
type: 'string'
}
...
]
}
....
}
and this is an event associated with a delete customer button:
onDeleteCustomerBtnTap: function(button, e, eOpts) {
var data = this.getCustomerDetail().getData();
var store = Ext.getStore("CustomerStore");
var record = store.getById(data.key);
store.remove(record);
store.sync();
}
EDIT:
this is the store
proxy: {
type: 'rest',
url: 'http://example.com/customers',
useDefaultXhrHeader: false,
appendId: false,
reader: {
type: 'json',
idProperty: 'key',
rootProperty: 'data'
},
writer: {
type: 'json'
}
}
The problem is when it tries to sync the store. The request url is http://example.com/customers?_dc=1394840324234 instead of http://example.com/customers/10?_dc=1394840324234.
What am I doing wrong?