I’m creating an application that has a high dependency on geographic location. I have variables ‘GeoApp.app.geoLat’ and GeoApp.app.geoLong’ in app.js that are set with the geo coordinates.
If I console.out within any view, I have no problem accessing and outputing the values. Within a store, the values are empty as if it doesn’t have access or perhaps variables haven’t been defined or exist.
What is the best practice achieve what I am trying to do?
Ext.define('GeoApp.store.Places', {
extend:'Ext.data.Store',
config: {
model:'GeoApp.model.Place',
autoLoad:'true',
proxy: {
type:'ajax',
url:'googleapiurl/json?location=' + GeoApp.app.geoLat + ','+ GeoApp.app.geoLong + '&radius=500...',
reader: {
type:'json',
rootProperty:'results'
}
}*/
}
})
What you can do is set the proxy url before you load the store. Therefor you have to set
autoLoadtofalse. You could use the code below in, for example, theshow()function of your view component.Good luck!