在所有嵌套项中使用商店引用

Using store reference in all nested items

我有以下问题,我正在尝试将控制器的引用传递给下面的所有项目。你知道我做错了什么我尝试了很多可能性,但我一直失败...... 我有

Ext.define('playground.view.MainTabPanel', {
    extend: 'Ext.tab.Panel',
    requires: ['playground.view.DrawItemsGrid', 'playground.view.DrawItemsList', 'playground.view.Graph'],
    layout: 'vbox',

    config:{
        store: Ext.data.StoreManager.get('DrawItemsStore')
    },
    initComponent: function() {
        this.callParent(arguments);

        this.add( Ext.create('playground.view.DrawItemsList', {
            store: this.store,
            title: 'List'
        }));

        this.add( Ext.create('playground.view.DrawItemsGrid',{
            store: this.store,
                    title: 'Grid'
        }));
        this.setActiveTab(0);
    }
});


Ext.define('playground.controller.LabeledSliders', {
    extend : 'Ext.app.Controller',
    stores : ['DrawItemsStore'],
    views : ['playground.view.DrawItemsGrid', 'playground.view.DrawItemsList'], //, 'playground.view.MainTabPanel']
    init: function() {
        this.control({
            'slider': {
                change: this.onSliderChanged
            }
        });
    },

    onSliderChanged: function(){
        var label =  arguments[0].fieldLabel;
        var value = arguments[2].value;
        var store = Ext.data.StoreManager.get(this.stores[0]);
        // var store = this.store;  THIS IS WHERE MY THIS DOES NOT BEKOME THE REFERENCE
        var rec = store.findRecord('label', label);

        if(rec.get('value') != value){
            rec.updateValue(value);
            // this.getController('Graphs').drawGraph();
        }
    }
});

HIS IS WHERE MY THIS DOES NOT BEKOME THE REFERENCE - is the place where i was hopeing to see there reference not undefined
Ext.define('playground.controller.Graphs', {
    extend  : 'Ext.app.Controller',
    // stores  : ['DrawItemsStore'],
    views   : ['playground.view.Graph'],

    init: function(){
        // console.log('init Graphs ctrl');
        this.control({
            'graph' :{
                'drawGraph': function (e, opts){ this.drawGraph(e, opts) }
            },
        });
    },  
    drawGraph: function(e, opts){
        console.log('draw graph');
        // var view = this.getPlaygroundViewGraphView();
        // view.setStore(this.store);
        var graph =  Ext.create('playground.drawings.RadarGraph', { store: ''});
        e.add(graph);
        e.doLayout();       
    }
 });

设置控制器后,stores 配置 属性 无法从控制器使用。相反,对于 stores 数组中定义的每个商店,您都会获得一个可以调用的函数。对于名为 MyStore1 的商店,函数将是 this.getMyStore1():

Ext.define('ConfigurationController',{
    extends:'Ext.app.Controller',
    stores:['ConfigStore'],
    init: function() {
        var me = this;
        this.control({
            'configForm field': {
                change: me.onConfigFormFieldChange
            }
        });
    },
    onConfigFormFieldChange: function(field) {
        field.up('form').updateRecord(this.getConfigStore().getAt(0))
    }
});