PDA

View Full Version : REST: problem with URL-Translation



ptek
9 Dec 2011, 1:44 PM
Hi,
I've built an ext-MVC application as a frontend to a restful server-application (some dummy-code below). when trying to add functionality to delete a model-instance by calling "destroy", the problem i face is that the URLs built by the store's proxy are not formatted as expected.

While I'd expect to see:
localhost/rest/test/7
the url called by the proxy is
localhost/rest/test/MY.model.Test-7

Thank you for any advices. I'd be also be very thankful to receive links that point to tutorials / sample code of ext js 4.x MVC rest applications.
Best regards,


// controller:
testsStoreInstance.destroy(testModelInstance);

// store class
Ext.define('MY.store.Tests', {
extend: 'Ext.data.Store',
requires: 'MY.model.Test',
model: 'MY.model.Test',
autoSync: true,
proxy: {
type: 'rest',
url: 'rest/test',

reader: {
type: 'json',
idProperty : 'id'
}
},
});

// model class
/*global Ext*/
Ext.define('MY.model.Text', {
extend: 'Ext.data.Model',
fields: [
'id',
'name'
],
});