我要去與煎茶MVC路線。我有一個視口面板初始化很像Twitter的例子:視窗應用條件與工具欄煎茶觸摸
/**
* @author Jeff Blake
*/
Ext.regApplication('App', {
defaultTarget: 'viewport',
defaultUrl : 'Viewport/index',
name : 'App',
icon : "mobile/public/resources/images/icon.png",
phoneStartupScreen : "mobile/public/resources/images/phone_startup.png",
//useHistory : false,
//useLoadMask : true,
launch: function() {
Ext.Viewport.init();
Ext.Viewport.onOrientationChange();
this.viewport = new App.Viewport({
application: this
});
Ext.dispatch({
controller: 'User',
action : 'index'
});
}
});
/**
* @class App.Viewport
* @extends Ext.Panel
* This is a default generated class which would usually be used to initialize your application's
* main viewport. By default this is simply a welcome screen that tells you that the app was
* generated correctly.
*/
App.Viewport = Ext.extend(Ext.Panel, {
id : 'viewport',
layout : 'card',
fullscreen: true,
cardSwitchAnimation: 'slide',
initComponent: function() {
Ext.apply(this, {
dockedItems: [
{
// Top Bar
dock : 'top',
xtype : 'toolbar',
title : 'Whats Good',
items: [
{
text: 'About'
},
]
}
]
});
App.Viewport.superclass.initComponent.apply(this, arguments);
}
});
Ext.reg('App.Viewport', App.Viewport);
新代碼:
if (!App.viewport.getDockedComponent(homeBar)) {
var homeBar = new App.HomeBar();
App.viewport.addDocked(homeBar);
}
我想在此基礎上面板的類型,目前呈現給能夠有條件地適用DockedItems(工具欄)在視口中。 EG:一個用於登錄,主屏幕,細節屏幕等
我使用Ext.apply(App.Viewport,{dockedItems:[App.LoginBar]})嘗試; 但這並不奏效。目前,它的工作方式與工具欄添加到當前呈現的面板,將其設置爲全屏,但不幸的是過渡和東西的行爲古怪的結構是
Panel
Toolbar
Panel
Toolbar
/end Panel
/end Panel
有沒有人有一個建議?
我得到TypeError:Object#沒有方法'addDocked' –
JBlake
2011-01-20 06:45:28
我的app.js看起來像這樣: – JBlake 2011-01-20 07:13:44