问题描述
我正在尝试将数据加载到extjs 4 TreeStore
中,但是在追加节点时,出现了node.updateInfo is not a function
错误.
I am trying to load data into an extjs 4 TreeStore
but while appending node, I am getting node.updateInfo is not a function
error.
我的模型类如下:
Dimension.js
Ext.define('ilp.model.Dimension', {
extend : 'Ext.data.Model',
require : [
'ilp.model.DimensionLevel'
],
fields : [
'actualName',
'displayName'
],
hasMany : {model : 'ilp.model.DimensionLevel', name : 'dimensionLevels'}
});
DimensionLevel.js
Ext.define('ilp.model.DimensionLevel', {
extend : 'Ext.data.Model',
fields : [
{name : 'name', type : 'string'},
{name : 'totalTrainees', type : 'int'}
]
});
和树存储代码如下:
Ext.define('ilp.store.DimensionTree', {
extend : 'Ext.data.TreeStore',
requires : [
'ilp.model.Dimension',
'ilp.model.DimensionLevel'
],
model : 'ilp.model.Dimension',
root: {
name: 'Dimensions'
},
proxy: {
type: 'ajax',
url: 'http://localhost:8080/pentaho/content/cda/doQuery',
reader: {
type: 'pentahoReader',
root: 'resultset'
},
extraParams: {
path: 'RINXDashboards%2FCDAs%2FILP_Employee_Qeries.cda',
dataAccessId:'Get_All_Levels_From_All_Dimensions',
userid : 'joe',
password : 'password'
}
},
listeners: {
append : function(parentNode, newNode, index, options) {
if(newNode.get('text') != 'Root') {
console.log('newNode text value = ' + newNode.get('text'));
newNode.set('checked', null);
newNode.set('expandable', true);
if(Ext.ClassManager.getName(newNode) == "ilp.model.Dimension") {
newNode.set('expanded', true);
newNode.set('text', newNode.get('displayName'));
if(newNode.dimensionLevels().getCount() > 0) {
newNode.dimensionLevels().each(function(level) {
newNode.appendChild(level);
});
} else {
newNode.set('leaf', true);
}
}else if(Ext.ClassManager.getName(newNode) == "ilp.model.DimensionLevel") {
newNode.set('leaf', true);
newNode.set('text', newNode.get('name'));
}
}
}
}
});
我在以下行上遇到了以上错误:newNode.dimensionLevels().each(function(level) {
I am getting above error on following line : newNode.dimensionLevels().each(function(level) {
在调试时,我发现newNode
的updateInfo()
方法是undefined
.
while debugging I have found that updateInfo()
method of newNode
is undefined
.
任何人都可以告诉我为什么会出现此错误吗?我现在已经一无所有了!!!
Can anyone please tell me why this error is coming? I am totally clueless now !!!
推荐答案
可能是由于EXTJSIV-6051错误
May this is caused by the bug EXTJSIV-6051
请参见 Sencha论坛了解更多信息
这篇关于在extjs中追加节点时,node.updateInfo不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!