0
有時候我們使用一個存儲來查看少量視圖(列表,輪播,數據視圖),當我們刷新(加載,過濾)存儲數據時,使用此存儲的所有視圖的dom都將重建,但某些視圖在此時不顯示,可能不會顯示這些數據。我們如何才能刷新列表DOM,只有當它顯示時,不是每次刷新時都刷新? 問題examle 僅當列表顯示時更新列表dom
Ext.define("Test.view.Main", {
extend: 'Ext.tab.Panel',
config: {
tabBarPosition: 'bottom',
items: [ ]
},
constructor : function(){
this.callParent(arguments);
var store = Ext.create('Ext.data.Store',{
data :[
{title : 'One'},
{title : 'Two'},
{title : 'Three'}
]
}),
firstList = Ext.create('Ext.List',{
title : 'tab1',
store : store,
itemTpl : '{title}',
onItemDisclosure : function(){
store.add({title : 'Four'});
}
}),
secondList = Ext.create('Ext.List',{
title : 'tab2' ,
store : store,
itemTpl : '{title}'
}),
thirdList = Ext.create('Ext.List',{
title : 'tab3',
store : store,
itemTpl : '{title}'
});
this.add([
firstList,
secondList,
thirdList
]) ;
}
});
當自來水在第一個列表項,在商店將被添加新項目。並且所有列表的dom將會改變,儘管第二和第三列表不會顯示 我看到一個選項。創建一個主商店併爲每個視圖創建單獨的商店。當視圖顯示從主商店填滿它時。但它看起來不太好。任何其他想法?