I'm very new to Sencha Architect 3.0, I want to set a MyApp.globals variable(initiated at launch method) as the parameter of my store. Like so:
Ext.define('MyApp.store.myCustomer', {
extend: 'Ext.data.Store',
requires: [
'MyApp.model.Customer',
'Ext.data.proxy.Ajax',
'Ext.data.reader.Json'
],
config: {
model: 'MyApp.model.Customer',
storeId: 'myCustomer',
proxy: {
type: 'ajax',
//global variable as parameter
extraParams: {
salesman: MyApp.globals.Salesman
},
url: 'http://localhost:96/OrdApplication/customer_list.php',
reader: {
type: 'json',
rootProperty: 'items'
}
}
}
});
This is my launch method
launch: function() {
MyApp.globals = {
count: 1,
Salesman :0
};
Ext.create('MyApp.view.MainView', {fullscreen: true});
}
});
Although this store is not bound to load with anything on launch,neither with the first view, but its still seems to be loading as i'm getting the following error on launch:
Uncaught TypeError: Cannot read property 'Salesman' of undefined sencha-touch.js:8619 Uncaught Error: The following classes are not declared even if their files have been loaded: 'MyApp.store.myCustomer'.
how do I handle this issue of not having the store loaded before the declaration of variable takes place. In fact it would be great if someone could tell me to load a store dynamically on button press and fill selectfield with it.