I am having the following issue, which I cannot seem to resolve, even searching the forums online yielded no useful hints.
I have the following code, which determines the first selected record in an Ext.Tree.Panel and sends a destroy request. However, a JSON object is posted instead of the expected name/value query string.
var record = this.getClientUserTree().getSelectedRecord();
record.destroy({
scope: this,
success: this.onDeleteUserSuccess,
failure: this.onDeleteUserFailure
});
I am including the code for the corresponding model as well as that of the dispatched request.
Ext.define('Admin.model.Client', {
extend: 'Ext.data.Model',
fields: ['id', 'name', 'company', 'address', 'postal_code', 'city', 'country', 'phone', 'fax', 'note'],
proxy: {
type: 'ajax',
api: {
read: 'clientajax',
destroy: 'clientajax/delete'
},
reader: {
type: 'json',
root: 'results'
}
}
});
Posted string in the request:
{"id":"14","client":"5","username":"Testtest","firstName":"Genti","lastName":"Testing","role":"admin","superadmin":false}
Can anyone tell me what I am doing wrong?
Thank you for your help in advance,
Genti
The
Ext.data.Modeldestroy method uses the proxy’s destroy method.Unfortunately I’ve never found a non JSON or XML proxy in the ExtJS4 API. I’ve always used the
Ext.data.proxy.ServerextraParams property to pass string value parameters to my server when I absolutely had to.You could also try extending the proxy to accommodate what you need but I’ve never tried it.
With all that said, keep in mind that there are a great deal of libraries for parsing JSON or XML, it isn’t too hard to integrate them on your server, you should take a look at that route also.