Extjs 如何在Sencha中刷新视图面板?
这看起来很简单,但我需要能够在Web服务调用后刷新视图 屏幕上的数据没有绑定到存储,因为它是在运行时动态构建的 以下是我的看法:Extjs 如何在Sencha中刷新视图面板?,extjs,sencha-touch-2,Extjs,Sencha Touch 2,这看起来很简单,但我需要能够在Web服务调用后刷新视图 屏幕上的数据没有绑定到存储,因为它是在运行时动态构建的 以下是我的看法: Ext.define('CAMSApp.view.OpBuyoffView', { extend: 'Ext.Panel', alias: ['widget.opbuyoffview'], //ToDo Use I18N config: { xtype: 'panel', cls: 'dialogview formview',
Ext.define('CAMSApp.view.OpBuyoffView', {
extend: 'Ext.Panel',
alias: ['widget.opbuyoffview'], //ToDo Use I18N
config: {
xtype: 'panel',
cls: 'dialogview formview',
centered: true,
scrollable: 'vertical',
modal: true,
screenId: 'opbuyoffview',
id: 'opBuyoffTableContainer',
layout: {
type: 'vbox',
align: 'center',
},
defaults: {
minHeight: 46
},
items: [
{
xtype: 'toolbar',
docked: 'top',
title: 'Buyoffs',
cls: 'grey-bold-34pt',
ui: 'transparent',
items: [{
xtype: 'button',
cls: 'grey-bold-40pt greyBtn',
text: 'Close',
idForAction: 'opbuyoff-cancel_btn',
}, {
xtype: 'spacer',
}],
},
{ id: 'opBuyoffToolbar',
xtype: 'container',
layout: {
type: 'hbox',
align: 'left',
},
items: [
{
xtype: 'button',
cls: 'blueRoundedBtn',
text: 'Buyoff',
idForUpdate: 'opbuyoff-buyoff_btn',
disabled: true
},
{ xtype: 'spacer',
minWidth: 480
}]
},
{
xtype: 'container',
layout: {
type: 'hbox',
align: 'stretch'
},
defaults: {
xtype: 'label',
style: 'border:1px solid black',
cls: 'opBuyoffTableHeader',
},
id: 'tabOfBuyoffs',
items: [{
html: '',
minWidth: 60
}, {
html: 'Buyoff',
minWidth: 250
}, {
html: 'Partial %',
minWidth: 100
}, {
html: 'Completed',
minWidth: 120
},
{
html: '',
cls: 'opBuyoffTransparent',
minWidth: 50
}
]
}],
listeners: {
initialize: function(me, eOpts) {
CAMSApp.util.I18N.resolveStaticUIBindings(me);
},
show: function (me, eOpts) {
// Publish the screen id event.
log('[OpBuyoff.show]');
CAMSApp.app.fireEvent('setscreenfocus', this);
},
},
}
});
我尝试过读取视图和容器,但两个元素都没有doLayout()或refresh()函数。容器和面板有一个名为
update(Ext.AbstractComponent-method-update)
的方法,可以用来更新视图的HTML内容
此外,您还可以使用XTemplate创建项目,并将面板绑定到存储区。在这种情况下,您不必手动删除和添加所有元素 另外-我只需要编辑容器:“TabofBuyoff”刷新视图意味着什么?我正在调用一个Web服务,需要能够在成功调用后刷新视图上的元素。我的理解是,应该有一些doLayout()或refresh()函数,但这两个函数都不起作用。好的,但您想要刷新的确切内容是什么?是否要重新创建所有项目?或者你只是想改变他们的内部HTMLs?我想重新创建所有的项目。我想我可以穿过并摧毁它们,然后重新创造它们。我只是想我可以调用一个函数来为我完成这项工作:)
refresh: function() {
// Ext.StoreMgr.get('stream').load();
// here I'd like to reload the app instead
// not just the store
window.location.reload();
}