在煎茶触摸添加按钮
问题描述:
我想从一个子视图(HotelApp.views.hotelDetail)更新主视图工具栏的内容在煎茶触摸添加按钮
这是HotelApp.views.mainView
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});
我甚至建议你不要使用“身份证”配置您的组件,但'itemId'。 这样,您可以通过调用
myView.getComponent('myComponentItemId');
或
myView.getDockedComponent('myComponentItemId');
像工具栏DockedComponents总是得到你的意见组件。 希望这有助于。
Theres in myView.getDcokedComponent('myComponentItemId'); –