本文地址:[http://blog.csdn.net/sushengmiyan/article/details/42016107](http://blog.csdn.net/sushengmiyan/article/details/42016107)
本文作者:[sushengmiyan](http://blog.csdn.net/sushengmiyan)
------------------------------------------------------------------------------------------------------------------------------------
為方便起見,使用sencha cmd創建一個工程,使用app build命令build工程,使用web start命令啟動服務。
好了,現在更改下main.js中的一點代碼,增加如下內容到panel中:
~~~
,{
xtype: 'combo',
width: '100',
labelWidth: '40',
fieldLabel: 'Theme',
displayField: 'name',
valueField: 'value',
//labelStyle: 'cursor:move;',
//margin: '5 5 5 5',
queryMode: 'local',
store: Ext.create('Ext.data.Store', {
fields: ['value', 'name'],
data : [
{ value: 'neptune', name: 'Neptune主題' },
{ value: 'neptune-touch', name: 'Neptune Touch主題' },
{ value: 'crisp', name: 'Crisp主題' },
{ value: 'crisp-touch', name: 'Crisp Touch主題' },
{ value: 'classic', name: 'Classic主題' },
{ value: 'gray', name: 'Gray主題' }
]
}),
//value: theme,
listeners: {
select: function(combo) {
var theme = combo.getValue();
var href = 'ext/packages/ext-theme-'+theme+'/build/resources/ext-theme-'+theme+'-all.css';
var link = Ext.fly('theme');
if(!link) {
link = Ext.getHead().appendChild({
tag:'link',
id:'theme',
rel:'stylesheet',
href:''
});
};
link.set({href:Ext.String.format(href, theme)});
}
}
}
~~~
main.js代碼應該如下所示:(完整內容)
~~~
/**
* This class is the main view for the application. It is specified in app.js as the
* "autoCreateViewport" property. That setting automatically applies the "viewport"
* plugin to promote that instance of this class to the body element.
*
* TODO - Replace this content of this view to suite the needs of your application.
*/
Ext.define('oaSystem.view.main.Main', {
extend: 'Ext.container.Container',
requires: [
'oaSystem.view.main.MainController',
'oaSystem.view.main.MainModel'
],
xtype: 'app-main',
controller: 'main',
viewModel: {
type: 'main'
},
layout: {
type: 'border'
},
items: [{
xtype: 'panel',
bind: {
title: '{name}'
},
region: 'west',
html: '<ul><li>This area is commonly used for navigation, for example, using a "tree" component.</li></ul>',
width: 250,
split: true,
tbar: [{
text: 'Button',
handler: 'onClickButton'
},{
xtype: 'combo',
width: '100',
labelWidth: '40',
fieldLabel: 'Theme',
displayField: 'name',
valueField: 'value',
//labelStyle: 'cursor:move;',
//margin: '5 5 5 5',
queryMode: 'local',
store: Ext.create('Ext.data.Store', {
fields: ['value', 'name'],
data : [
{ value: 'neptune', name: 'Neptune主題' },
{ value: 'neptune-touch', name: 'Neptune Touch主題' },
{ value: 'crisp', name: 'Crisp主題' },
{ value: 'crisp-touch', name: 'Crisp Touch主題' },
{ value: 'classic', name: 'Classic主題' },
{ value: 'gray', name: 'Gray主題' }
]
}),
//value: theme,
listeners: {
select: function(combo) {
var theme = combo.getValue();
var href = 'ext/packages/ext-theme-'+theme+'/build/resources/ext-theme-'+theme+'-all.css';
var link = Ext.fly('theme');
if(!link) {
link = Ext.getHead().appendChild({
tag:'link',
id:'theme',
rel:'stylesheet',
href:''
});
};
link.set({href:Ext.String.format(href, theme)});
}
}
}]
},{
region: 'center',
xtype: 'tabpanel',
items:[{
title: 'Tab 1',
html: '<h2>Content appropriate for the current navigation.</h2>'
}]
}]
});
~~~


糾結了很久的問題終于釋懷了。之前看的都是使用swapstylesheet我一直么有成功過。偶爾看的了這篇文章,覺得不錯,果真成功了。
[http://extjs.eu/lightweight-theming/](http://extjs.eu/lightweight-theming/)
推薦一下,這個網站,內容比較充實,界面也比較好看。就是有些插件需要花錢購買。
- 前言
- [EXtJS5學習筆記]第一節 Sencha Cmd 學習筆記 簡介 Sencha Cmd是什么
- [ExtJS5學習筆記]第二節 Sencha Cmd 學習筆記 使你的sencha cmd跑起來
- [ExtJS5學習筆記]第三節 sencha cmd學習筆記 生成應用程序構建的內部細節
- [ExtJS5學習筆記]第四節 歡迎來到extjs5-手把手教你實現你的第一個應用
- [ExtJS5學習筆記]第五節 使用fontawesome給你的extjs5應用增加字體圖標
- [ExtJS5學習筆記]第六節 Extjs的類系統Class System命名規則及定義和調試
- [ExtJS5學習筆記]第七節 Extjs5的組件components及其模板事件方法學習
- [ExtJS5學習筆記]第八節 Extjs5的Ext.toolbar.Toolbar工具條組件及其應用
- [ExtJS5學習筆記]第九節 Extjs5的mvc與mvvm框架結構簡介
- [ExtJS5學習筆記]第十節 Extjs5新增特性之ViewModel和DataBinding
- [ExtJS5學習筆記]第十一節 Extjs5MVVM模式下系統登錄實例
- [ExtJS5學習筆記]第十二節 Extjs5開發遇到的問題列表記錄
- [ExtJS5學習筆記]第十三節 Extjs5的Ext.each方法學習
- [ExtJS5學習筆記]第十四節 Extjs5中data數據源store和datapanel學習
- [ExtJS5學習筆記]第十五節 Extjs5表格顯示不友好?panel的frame屬性在作怪
- [ExtJS5學習筆記]第十六節 Extjs5使用panel新增的ViewModel屬性綁定數據
- [ExtJS5學習筆記]第十七節 Extjs5的panel組件增加accodion成為折疊導航欄
- [ExtJS5學習筆記]第十八節 Extjs5的panel的dockeditems屬性配置toolbar
- [ExtJS5學習筆記]第十九節 Extjs5中通過設置form.Panel的FieldSet集合屬性控制多個field集合
- [ExtJS5學習筆記]第二十節 Extjs5配合數組的push方法,動態創建并加載組件
- [ExtJS5學習筆記]第二十一節 Extjs5中使用config配置給ext.widget或者create方法傳遞參數
- [ExtJS5學習筆記]第二十二節 Extjs5中使用beforeLabelTpl配置給標簽增加必填選項星號標志
- [ExtJS5學習筆記]第二十三節 Extjs5中表格gridpanel的列格式設置
- [ExtJS5學習筆記]第二十四節 Extjs5中表格gridpanel或者表單數據后臺傳輸remoteFilter設置
- [ExtJS5學習筆記]第二十五節 利用window.open()函數實現ExtJS5的登陸頁面跳轉
- [EXTJS5學習筆記]第二十六節 在eclipse/myeclipse中使用sencha extjs的插件
- [ExtJS5學習筆記]第二十七節 CMD打包錯誤 Error C2009: YUI Parse Error (identifier is a reserved word =&gt; debugger;)
- [ExtJS5學習筆記]第二十八節 sencha ext js 5.1.0發布版本正式發布 extjs doc下載地址
- [ExtJS5學習筆記]第二十九節 sencha ext js 5.1.0中動態更換皮膚主題
- [ExtJS5學習筆記]第三十節 sencha extjs 5表格gridpanel分組匯總
- [ExtJS5學習筆記]第三十一節 sencha extjs 5使用cmd生成的工程部署到tomcat服務器
- [ExtJS5學習筆記]第三十二節 sencha extjs 5與struts2的ajax交互配置
- [ExtJS5學習筆記]第三十五節 sencha extjs 5 組件查詢方法總結