Cp_Barbossa
17 Sep 2012, 9:23 AM
Hello.
I have a problem on listening store events in controller.
So, my store looks like this:
Ext.define('app.store.MyTreeStore', {
extend: 'Ext.data.TreeStore',
alias: 'widget.mytreestore',
model: 'some model',
proxy: {
type: 'ajax',
url: 'some url'
}
});
And now, in my controller i'm trying to listen beforeload event:
Ext.define('app.controller.ApplicationController', {
extend: 'Ext.app.Controller',
stores: [
'app.store.MyTreeStore'
],
init: function () {
this.getStore('MyTreeStore').on('beforeload', this.onBeforeLoad, this);
},
onBeforeLoad: function () {
alert('');
}
});
So, the problem is that as soon as init function executes firebug gives me an error, seems like store tries to load data, but not according the proxy url, it posts something like this:
Get http://localhost/MyProject/scripts/app/store/MyTreeStore.js?_dc (http://wd/wd/wad/wadwd/wdwadwa/wdwadwd)=1347900348333 (http://localhost/MyProject/scripts/app/store/MyTreeStore.js?_dc=1347900348333)
I believe getStore() method creates store if not exists and maybe trying to load something? I want to prevent that. I did turn store autoLoad to false but did not help.
Do not understand what is happening.
Can someone help me? And what is the best way to listen store events in controller?
I have a problem on listening store events in controller.
So, my store looks like this:
Ext.define('app.store.MyTreeStore', {
extend: 'Ext.data.TreeStore',
alias: 'widget.mytreestore',
model: 'some model',
proxy: {
type: 'ajax',
url: 'some url'
}
});
And now, in my controller i'm trying to listen beforeload event:
Ext.define('app.controller.ApplicationController', {
extend: 'Ext.app.Controller',
stores: [
'app.store.MyTreeStore'
],
init: function () {
this.getStore('MyTreeStore').on('beforeload', this.onBeforeLoad, this);
},
onBeforeLoad: function () {
alert('');
}
});
So, the problem is that as soon as init function executes firebug gives me an error, seems like store tries to load data, but not according the proxy url, it posts something like this:
Get http://localhost/MyProject/scripts/app/store/MyTreeStore.js?_dc (http://wd/wd/wad/wadwd/wdwadwa/wdwadwd)=1347900348333 (http://localhost/MyProject/scripts/app/store/MyTreeStore.js?_dc=1347900348333)
I believe getStore() method creates store if not exists and maybe trying to load something? I want to prevent that. I did turn store autoLoad to false but did not help.
Do not understand what is happening.
Can someone help me? And what is the best way to listen store events in controller?