Sencha Touch - 如何在嵌套列表中显示最新内容?
假设在 Sencha Touch 中,我创建了一个嵌套列表,如下所示。
var NestedList = createList(jsonDataObject,'leftNavigation','list','bookmark-icon');
function createList( data , id , cls, iconCls)
{
var store = new Ext.data.TreeStore({
model: 'ListItem',
root: data,
proxy: {
type: 'ajax',
reader: {
type: 'tree',
root: 'items'
}
}
});
var leftNav = new Ext.NestedList({
// cardSwitchAnimation: false,
dock: 'left',
id: id,
cls: 'card '+cls,
useTitleAsBackText: true,
title: data.text ,
iconCls: iconCls,
displayField: 'text',
width: '350',
store: store});
}
过了一段时间,jsonDataObject
的内容将会更改(通过 setInterval()
调用定期进行更改,或者由于用户交互)。我可能还需要向 NestedList
存储提交一个全新的 jsonDataObject
。所以我的问题是:
a) 如何让 NestedList
刷新并显示包含新数据的新 UI?
b) 我的 createList()
实现是创建 Nestlisted
的最合适方法吗?或者有更好的方法来实现我的目的吗?
So let's say in Sencha Touch, I created a Nested List like so
var NestedList = createList(jsonDataObject,'leftNavigation','list','bookmark-icon');
function createList( data , id , cls, iconCls)
{
var store = new Ext.data.TreeStore({
model: 'ListItem',
root: data,
proxy: {
type: 'ajax',
reader: {
type: 'tree',
root: 'items'
}
}
});
var leftNav = new Ext.NestedList({
// cardSwitchAnimation: false,
dock: 'left',
id: id,
cls: 'card '+cls,
useTitleAsBackText: true,
title: data.text ,
iconCls: iconCls,
displayField: 'text',
width: '350',
store: store});
}
After a while, the contents of jsonDataObject
will change (either periodically via a setInterval()
call or because of user interaction). I may also need to submit an entirely new jsonDataObject
to the NestedList
store. So my questions are:
a) How do I get the NestedList
to refresh and display a new UI with the new data?
b) Is my implementation of createList()
the most appropriate way to create a Nestlisted
? Or is there a better way for my purposes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于没有人及时回答我的问题,我使用了一种解决方法。
我保留了问题中的代码。嵌套列表由容器面板使用。所以我所做的就是从容器面板中删除旧的嵌套列表,销毁它,然后创建一个新的嵌套列表,并将其插入回容器面板。举个例子:
Because no one answered my question in time, I used a work around.
I kept the code as is in the question. The nested list is used by a container panel. So what I did was remove the old nestedlist from the container panel, destroy it, then create a new nestedlist, and insert it back to container panel. As an example: