Sencha Touch:TabPanel 内的工具栏
我是 Sencha Touch 的新手,只是想将工具栏放在 TabPanel 中。 我这样做是因为 TabPanel 将成为我的主要导航,而工具栏将提供一些与内容相关的操作,例如创建新的作业或类似的操作。
这是我的“解决方案”,但根本行不通。 TabPanel 会出现,“Hello World”也会出现,但不会有任何工具栏。
var tapHandler = function(btn, evt) {
alert("Button "+btn.text+" tapped");
}
var HomeScreen = new Ext.Panel({
fullscreen: true,
dockedItems: [
{
xtype: "toolbar",
title: "buttons",
ui: "light",
dock: "bottom",
items: [
{ui: "action", text: "Add"}
],
defaults: {
handler: tapHandler
}
}
],
html: "Hello World"
});
new Ext.Application({
name: "Hello World",
launch: function() {
var tabPanel = new Ext.TabPanel({
fullscreen: true,
ui: 'dark',
sortable: true,
items: [
{
title: "Home",
html: "Loading..."
}
]
});
tabPanel.items.get(0).update(HomeScreen, true);
}
});
你有什么解决办法吗?
问候, 马丁
I'm new to Sencha Touch and just trying to put a Toolbar inside of a TabPanel.
I do that because the TabPanel will be my main navigation and the Toolbar will provide several content-related operations, such as creating a new homework or sth like that.
Here is my "solution", that crtly doesn't work. The TabPanel appears, and the "Hello World" do so, too, but there won't be any Toolbar.
var tapHandler = function(btn, evt) {
alert("Button "+btn.text+" tapped");
}
var HomeScreen = new Ext.Panel({
fullscreen: true,
dockedItems: [
{
xtype: "toolbar",
title: "buttons",
ui: "light",
dock: "bottom",
items: [
{ui: "action", text: "Add"}
],
defaults: {
handler: tapHandler
}
}
],
html: "Hello World"
});
new Ext.Application({
name: "Hello World",
launch: function() {
var tabPanel = new Ext.TabPanel({
fullscreen: true,
ui: 'dark',
sortable: true,
items: [
{
title: "Home",
html: "Loading..."
}
]
});
tabPanel.items.get(0).update(HomeScreen, true);
}
});
Do you have any solutions?
Greetings,
Martin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这里的问题很可能是 update() 方法需要一个 HTML 字符串,而 HomeScreen 是一个 Ext.Panel。
如果是我,我会通过使用如下变量将 HomeScreen 添加到 tabPanel 中的 items 集合中:
或者通过在 items 数组中将其定义为对象:
或者通过使用 TabPanel.add() 方法:
I think the problem here may well be that the update() method expects an HTML string and HomeScreen is an Ext.Panel.
If it were me, I'd be adding HomeScreen to the items collection in tabPanel either by using the variable like this:
Or by defining it inside the items array as an object:
Or by using the TabPanel.add() method: