【发布时间】:2014-07-21 13:16:01
【问题描述】:
我有一个这样的组件
Ext.define('Fleximanager.view.pages.home', {
extend: 'Fleximanager.view.main.FlexiTab',
store: Ext.create('Fleximanager.store.hometables'), // this is the store for each instance
items: [{
xtype: 'dateselector'
},{
xtype: 'dataview',
flex: 5,
store: this.up('flexitab').store, //this store should be the same as above
itemTpl: new Ext.XTemplate(
//the xtemplate here
)
}]
});
应使用此类的每个新实例创建商店,然后应该可以从数据视图项访问它。 这是 FlexiTab 的定义:
Ext.define('Fleximanager.view.main.FlexiTab', {
extend: 'Ext.panel.Panel',
xtype: 'flexitab',
requires: [
'Fleximanager.view.tools.DateSelector'
],
closable: true,
layout: {
type: 'vbox',
align: 'stretch'
},
initComponent: function(){
this.reload();
this.renderTo = Ext.getBody();
this.callParent();
},
reload: function(extraParams){
params = {
hostname: sessionStorage.hostname,
auth: sessionStorage.authSessionId,
corp: sessionStorage.activeCorp
};
if(typeof extraParams !== "undefined"){
for (var key in extraParams){
params[key] = extraParams[key];
}
}
this.store.load({
params: params,
callback: function(records, operation, success) {
console.log('successfully loaded store: ', records);
}
});
}
});
但是我总是得到一个错误:Uncaught TypeError: undefined is not a function 指的是 up() 函数,所以数据视图项似乎没有 up() 方法。
我的问题是:如何访问 store 实例?
感谢您的回复
【问题讨论】:
标签: javascript extjs model-view-controller extjs4