extjs刷新树存储
如何刷新树存储 我试着这样做:extjs刷新树存储,extjs,tree,store,Extjs,Tree,Store,如何刷新树存储 我试着这样做: Ext.getStore('myStore').setRootNode({child: []}); 然后商店会要求服务器有孩子,但有时它会给我一个双倍的孩子。 在我的树上,我得到了这样的东西: child1 child2 child1 还有一个javascript错误: Uncaught TypeError: Cannot read property 'internalId' of undefined Ext.define.updateIndexes ext-
Ext.getStore('myStore').setRootNode({child: []});
然后商店会要求服务器有孩子,但有时它会给我一个双倍的孩子。
在我的树上,我得到了这样的东西:
child1
child2
child1
还有一个javascript错误:
Uncaught TypeError: Cannot read property 'internalId' of undefined
Ext.define.updateIndexes ext-all-debug.js:61588
Ext.define.onAdd ext-all-debug.js:61513
Base.implement.callParent ext-all-debug.js:3728
这是一个bug还是我做错了什么?我不确定您使用的是哪个版本的extjs,但下面是我如何使用load方法在4.1中刷新我的存储(您可能有参数,也可能没有参数,我有参数): 存储区将使用新记录刷新,并且没有以前加载的重复记录 我的店铺设置如下:
Ext.define('MyApp.store.MyTreeStore', {
extend: 'Ext.data.TreeStore',
model: 'MyApp.model.MyTreeModel',
root: {
children: []
},
proxy: {
type: 'ajax',
url: '/MyApp/Chart/GetTree'
},
fields: [
{ name: 'id', type: 'int' }
]
});
我的树是这样的:
Ext.define('MyApp.view.chart.MyTree', {
extend: 'Ext.tree.Panel',
alias: 'widget.mytree',
id: 'MyTree',
store: 'MyTreeStore',
width: 350,
height: 320,
border: false,
rootVisible: false,
singleExpand: true
});
谢谢我解决了这个问题,我做了两次非常封闭的刷新。这就是为什么我有一些双打。
Ext.define('MyApp.view.chart.MyTree', {
extend: 'Ext.tree.Panel',
alias: 'widget.mytree',
id: 'MyTree',
store: 'MyTreeStore',
width: 350,
height: 320,
border: false,
rootVisible: false,
singleExpand: true
});