Sencha touch 在Sencha Touch中添加按钮
我想从子视图(HotelApp.views.hotelDetail)更新主视图的工具栏内容 这是HotelApp.views.mainView中的我的工具栏Sencha touch 在Sencha Touch中添加按钮,sencha-touch,Sencha Touch,我想从子视图(HotelApp.views.hotelDetail)更新主视图的工具栏内容 这是HotelApp.views.mainView中的我的工具栏 this.topBar = new Ext.Toolbar({ dock:'top', id:'main_page_topbar', title:'H10 Sencha Demo', items:[this.back,
this.topBar = new Ext.Toolbar({
dock:'top',
id:'main_page_topbar',
title:'H10 Sencha Demo',
items:[this.back,
{xtype: 'spacer'}
]
});
工具栏已具有“后退”按钮。问题是我可以看到按钮的形状,但也没有文本ID。我做错了什么
我使用以下代码:
var toolbar = HotelApp.views.mainView.getDockedItems()[1];
var images = new Ext.Button({
text:'Images',
id:'images',
ui:'drastic'
})
toolbar.setTitle(record.get('nombre'));
toolbar.add({items: images});
toolbar.doLayout();
谢谢 我认为您的问题只是您必须添加按钮调用
toolbar.add(images);
而不是
toolbar.add({items: images});
我甚至建议您不要对组件使用'id'配置,而是使用'itemId'。
通过这种方式,您可以通过调用
myView.getComponent('myComponentItemId');
或
用于DockedComponent,如工具栏。
希望这有帮助。myView.getDcokedComponent('myComponentItemId')中有一个输入错误;
myView.getDockedComponent('myComponentItemId');