Reputation: 4504
ExtJS6 model is not forming correct proxy urls for dynamic parameters
Model looks like
Ext.define('Testt.model.User', {
extend: 'Ext.data.Model',
fields: ['id', 'name'],
proxy: {
type: 'ajax',
api : {
read : 'api/user/:id',
create : 'api/user',
update : 'api/user/:id',
destroy : 'api/user/:id'
},
reader : {
type : 'json'
},
writer : {
type : 'json'
}
}
});
Now when called to load a user record like
Testt.model.load(27, { success: function(rec){console.log(rec)}})
It does not replace :id
with actual 27
Upvotes: 0
Views: 211
Reputation: 3258
If you use the REST Proxy type (http://docs.sencha.com/extjs/6.0.1-classic/Ext.data.proxy.Rest.html) then the IDs will be automatically appended to your URLs. You don't need the ':id' syntax in the urls.
Check out this fiddle to see it working: https://fiddle.sencha.com/#fiddle/1cri
Upvotes: 4