I have a Store where I am trying to define its proxy in the constructor, like so:
Ext.define('App.store.LabStore', {
extend: 'Ext.data.Store',
constructor: function(config) {
var prox = new Ext.data.proxy.Ajax();
prox.setUrl('http://server:port/app/labs');
prox.setHeaders({'Content-type': 'application/json'});
prox.setReader({type: 'json',rootProperty: 'departmentList'});
this.setProxy(prox);
this.callParent(arguments);
},
autoLoad: false,
model: 'App.model.Lab'
});
Unfortunately, this won't work. What does work, from my controller, is this:
var labStore = Ext.create("App.store.LabStore");
var url = 'http://server:port/app/labs';
labStore.getProxy().setUrl(url);
labStore.on('load','checkLabs',this);
labStore.load();
I realize that the latter method works and perhaps I should just move on but I do want to try to figure out why I cannot set the proxy in the constructor and/or what I'm doing wrong with that approach.
Thanks in advance!
Frank