I want to change the value in one of my views of my project depending on the user's url. Currently, I have a store class that loads in the url dynamically using the loadStore method.
Ext.define('store.app.appStore', {
extend : 'store.Store'
, model : 'model.app.appModel'
, alias : 'widget.app-appstore'
, proxy : {
type : 'rest'
, url : ''
, reader : {
type : 'json'
}
}
, loadStore : function(id) {
this.getProxy().url = app.getApplication().getAppUrl();
console.log(this.getProxy().url);
this.load({});
}
});
And a controller that loads the url depending on the id, and on start up then updates my form with the data.
Ext.define('controller.app.appController', {
extend : 'Ext.app.Controller',
refs :
{ref : 'appView', selector : 'app-appview'}
],
stores : ['app.appStore'],
init : function() {
this.control({
'app-appview' : {
selectionchange : this.onStartUp
}
});
},
onStartUp : function() {
this.getStore('app.appStore').loadStore();
this.getAppView().updateForm({PARAMETER});
}
However, I'm having a problem in working out how to assign a variable to the data I am loading, so that in my updateForm() method I would replace {(PARAMETER)} with the data.
The model looks like this:
Ext.define('model.app.Summary', {
extend : 'Ext.data.Model',
fields : [
'id', 'name', 'address', 'phone', 'optionOne', 'optionTwo'
],
getId : function() {
return this.get('id');
},
getName : function() {
return this.get('name');
},
getAddress : function() {
return this.get('address');
},
getPhone : function() {
return this.get('phone');
},
getOptionOne : function() {
return this.get('optionOne');
},
getOptionTwo : function() {
return this.get('optionTwo');
},
});
Any suggestions?