PDA

View Full Version : How to access to a Store from a controller?



m00l
7 Sep 2011, 12:54 AM
Hi,

i am using Ext JS since 2 days and i really like it.
But there are often some small problems i cannot solve.

I created my app with the MVC of the tutorial.

I want to use the buffered Scrolling, see http://dev.sencha.com/deploy/ext-4.0.2a/examples/grid/buffer-grid.html

So i have to call the method
myStore.guaranteeRange(0, 199); for the buffered Scrolling plugin.

My question is:
How can i access to the store with the storeID "myStore" from a controller of my app?

i tried:


Ext.define('gigadmin.controller.MyController', {
extend: 'Ext.app.Controller',
views: [
...
],
stores: [
'MyStore'
],
models: ['MyModel'],


init: function() {
this.control({
..
});
var myStore = Ext.data.StoreManager.lookup('myStore')
myStore.guaranteeRange(0, 199);
},
});

i also tried
this.getStore();.

But both didn't work.

Would be great if somebody knows how to fix that.

Thanks for your help!

campersau1
7 Sep 2011, 1:06 AM
There are to methods to do this:


this.getMyStoreStore();

this.getStore("MyStore");