I would put a variable in my proxy api store (using crud) but it not work.
The api config is an object , could you use a variable in object in javascript ?
I use Sencha Architect and he format api...
Do you have a suggest ?
My base store :
Ext.define('ModuleGestion.store.Pays', {
extend: 'Ext.data.Store',
requires: [
'ModuleGestion.model.Pays'
],
constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
autoLoad: true,
model: 'ModuleGestion.model.Pays',
storeId: 'StorePays',
proxy: {
type: 'ajax',
api: {
create: 'http://visual04/ModuleGestion/php/Pays.php?action=create',
read: 'http://visual04/ModuleGestion/php/Pays.php?action=read',
update: 'http://visual04/ModuleGestion/php/Pays.php?action=update',
destroy: 'http://visual04/ModuleGestion/php/Pays.php?action=destroy'
},
reader: {
type: 'json',
root: 'data'
},
writer: {
type: 'json',
root: 'data'
}
}
}, cfg)]);
}
});
My model with variable in api proxy
var Url = 'http://visual04/ModuleGestion/php/';
var UrlPays = Url+'Pays.php';
Ext.define('ModuleGestion.store.Pays', {
extend: 'Ext.data.Store',
requires: [
'ModuleGestion.model.Pays'
],
constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
autoLoad: true,
model: 'ModuleGestion.model.Pays',
storeId: 'StorePays',
proxy: {
type: 'ajax',
api: '{
create: UrlPays+'action=create',
read: UrlPays+'action=read',
update: UrlPays+'action=update',
destroy: UrlPays+'action=destroy'
}',
reader: {
type: 'json',
root: 'data'
},
writer: {
type: 'json',
root: 'data'
}
}
}, cfg)]);
}
});