Sencha touch 2 Sencha Touch嵌套列表在向树存储添加数据后未刷新
我有一个sencha应用程序,它有一个嵌套视图。如果我在存储中内联硬编码数据,视图就会被填充。但如果我动态创建datajson并将其添加到存储中,则不会发生任何事情。即使存储中似乎有数据,视图也不会被刷新 我有一个xtype:nestedlist的视图 到目前为止,当我在存储中内联定义数据时,它工作得很好 如果我希望动态添加相同的数据,该怎么办 我试图添加此数据,但视图嵌套列表无法刷新 例如:Sencha touch 2 Sencha Touch嵌套列表在向树存储添加数据后未刷新,sencha-touch-2,nested-lists,Sencha Touch 2,Nested Lists,我有一个sencha应用程序,它有一个嵌套视图。如果我在存储中内联硬编码数据,视图就会被填充。但如果我动态创建datajson并将其添加到存储中,则不会发生任何事情。即使存储中似乎有数据,视图也不会被刷新 我有一个xtype:nestedlist的视图 到目前为止,当我在存储中内联定义数据时,它工作得很好 如果我希望动态添加相同的数据,该怎么办 我试图添加此数据,但视图嵌套列表无法刷新 例如: 我在商店里试过自动加载和自动同步。什么也没发生。救命啊 解决了它。在包含嵌套列表视图的父面板中添加了配
我在商店里试过自动加载和自动同步。什么也没发生。救命啊 解决了它。在包含嵌套列表视图的父面板中添加了配置、布局:“fit”
items:[{
xtype: 'nestedlist',
store: 'MyNestedStore',
title: 'My nested list',
itemTpl: [
'<div class=""><span>{text} </span><span></div>',
],
Ext.define('MyApp.store.MyNestedStore', {
extend: 'Ext.data.TreeStore',
config: {
model: 'MyApp.model.MyNestedStore',
defaultRootProperty: 'data',
data: [{
category_id: 1,
text: 'Clothing',
data:[{
category_id: 1,
sub_category_id: 1,
text: 'Tops and Tees',
leaf:true,
},{
category_id: 1,
sub_category_id: 2,
text: 'Casual Shirts',
leaf:true,
}]
}, {
category_id: 2,
text: 'Footwear',
data:[{
category_id: 2,
sub_category_id: 1,
text: 'Casual Shoes',
leaf:true,
}]
}]
}
});
var store = Ext.getStore('MyNestedStore');
store.removeAll(); // works fine
store.add([{
category_id: 1,
text: 'Clothing',
data:[{
category_id: 1,
sub_category_id: 1,
text: 'Tops and Tees',
leaf:true,
},{
category_id: 1,
sub_category_id: 2,
text: 'Casual Shirts',
leaf:true,
}]
}, {
category_id: 2,
text: 'Footwear',
data:[{
category_id: 2,
sub_category_id: 1,
text: 'Casual Shoes',
leaf:true,
}]
}]) //data added to store but view did not get refreshed.