CiaranT
19 Jun 2012, 11:32 PM
Hi there,
I want to modify the details of a treestore record and send the 'Update' to the DLL specified in my API.
The record is updated in the tree, but no call is made to the DLL.
This is the code i am using to update the record.
var rec = store.getNodeById(sAssetID);
rec.beginEdit();
rec.set('Asset_ID', sAssetID);
rec.set('Name', sName);
rec.set('text', sName);
rec.phantom = false;
rec.endEdit();
rec.commit();
// Sync the changes
store.sync({
scope: this,
success: function () {
console.log("SUCCESS sync");
},
failure: function () {
console.log("FAILED sync");
}
});
Treestore proxy
proxy: {
type: 'ajax',
api: {
create: 'http://localhost/a.dll/asset?method=Create',
read: 'http://localhost/a.dll/asset?method=Read',
update: 'http://localhost/a.dll/asset?method=Update',
destroy: 'http://localhost/a.dll/asset?method=Delete'
},
url: 'http://localhost/a.dll/asset',
reader: {
type: 'json',
root: 'Assets'
},
writer: {
type: 'json'
}
}
The datamodel:
Ext.define('App.model.dmAsset', {
extend: 'Ext.data.Model',
idProperty: 'Asset_ID',
fields: [
{
mapping: 'Asset_ID',
name: 'Asset_ID',
type: 'string'
},
{
mapping: 'Name',
name: 'Name',
type: 'string'
}
/snip
]
});
Any ideas why the Update is not getting called? Thank you :)
I want to modify the details of a treestore record and send the 'Update' to the DLL specified in my API.
The record is updated in the tree, but no call is made to the DLL.
This is the code i am using to update the record.
var rec = store.getNodeById(sAssetID);
rec.beginEdit();
rec.set('Asset_ID', sAssetID);
rec.set('Name', sName);
rec.set('text', sName);
rec.phantom = false;
rec.endEdit();
rec.commit();
// Sync the changes
store.sync({
scope: this,
success: function () {
console.log("SUCCESS sync");
},
failure: function () {
console.log("FAILED sync");
}
});
Treestore proxy
proxy: {
type: 'ajax',
api: {
create: 'http://localhost/a.dll/asset?method=Create',
read: 'http://localhost/a.dll/asset?method=Read',
update: 'http://localhost/a.dll/asset?method=Update',
destroy: 'http://localhost/a.dll/asset?method=Delete'
},
url: 'http://localhost/a.dll/asset',
reader: {
type: 'json',
root: 'Assets'
},
writer: {
type: 'json'
}
}
The datamodel:
Ext.define('App.model.dmAsset', {
extend: 'Ext.data.Model',
idProperty: 'Asset_ID',
fields: [
{
mapping: 'Asset_ID',
name: 'Asset_ID',
type: 'string'
},
{
mapping: 'Name',
name: 'Name',
type: 'string'
}
/snip
]
});
Any ideas why the Update is not getting called? Thank you :)