1

我以轮播形式添加了一个数据视图,它显示为一个列表。然后我删除了数据视图的几个项目,但轮播视图中的列表没有改变。我应该怎么做才能刷新视图?

我尝试了几种方法,例如'remove()','removeAll()','destroy()','refresh()',但它没有效果。

模型:

Ext.define('Chihiro.model.User', {
extend: 'Ext.data.Model',
config: {
    fields: [ 'id', 'name', 'nickname', 'signiture', 'gender', 'birthday', 'school', 'job', 'portrait', 'interests', 'dis'],
    proxy: {
        type: 'localstorage',
        id: 'friends'
    },
    autoLoad: true
}
});

数据视图:

Ext.define('Chihiro.view.userlist.List', {
extend: 'Ext.DataView',
xtype: 'userlist',

store: {
    model: 'Chihiro.model.User'
},
config: {
    ui:'loans',
    useComponents: true,
    defaultType: 'listitem',
    emptyText: '<div style="margin-top: 20px; text-align: center">没有找到任何人哦</div>',
    deselectOnContainerClick: false
}
});

控制板:

Ext.define('Chihiro.view.contact.List', {
extend: 'Ext.Carousel',

xtype: 'contactpanel',
id: 'contactnavigationview',

layout: 'vbox',
config: {
    fullscreen: true,
    //autoDestroy: false,
    scrollable: true,
    //defaultBackButtonText: '返回',
    items: [
        {
            xtype: 'titlebar',
            docked: 'top',
            title: '好友'
        }
    ]
}
});
4

1 回答 1

3

您将需要重新加载商店以刷新数据视图。

remove(), removeAll(),destroy()和之类的方法refresh()肯定不会有任何效果。

当您更改商店内的项目时,您需要load()在数据存储上调用方法。这将实质上刷新您的数据视图。

yourStoreForDataView.load();

有用的帖子:煎茶触摸:刷新列表:商店

于 2012-04-25T11:54:35.593 回答