Extjs 在所有嵌套项中使用存储引用
我有以下问题,我试图将控制器的引用传递给下面的所有项。你知道我做错了什么吗?我尝试了很多可能性,但一直失败。。。 我有Extjs 在所有嵌套项中使用存储引用,extjs,extjs4,extjs4.1,extjs4.2,Extjs,Extjs4,Extjs4.1,Extjs4.2,我有以下问题,我试图将控制器的引用传递给下面的所有项。你知道我做错了什么吗?我尝试了很多可能性,但一直失败。。。 我有 设置控制器后,存储配置属性在控制器中不可用。相反,对于stores数组中定义的每个store,您可以调用一个函数。对于名为MyStore1的存储,函数应该是this.getMyStore1(): 谢谢你的提示,我会尽快检查,然后接受回复,ty:) Ext.define('playground.view.MainTabPanel', { extend: 'Ext.tab.
设置控制器后,
存储
配置属性在控制器中不可用。相反,对于stores数组中定义的每个store,您可以调用一个函数。对于名为MyStore1
的存储,函数应该是this.getMyStore1()
:
谢谢你的提示,我会尽快检查,然后接受回复,ty:)
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();
}
});
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))
}
});