本文地址:http://blog.csdn.net/sushengmiyan/article/details/42016107

本文作者: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/

推荐一下,这个网站,内容比较充实,界面也比较好看。就是有些插件需要花钱购买。

[ExtJS5学习笔记]第二十九节 sencha ext js 5.1.0中动态更换皮肤主题的更多相关文章

  1. [EXTJS5学习笔记]第二十六节 在eclipse/myeclipse中使用sencha extjs的插件

    本文地址:http://blog.csdn.net/sushengmiyan/article/details/40507383 插件下载: http://download.csdn.net/detai ...

  2. [ExtJS5学习笔记]第二十五节 利用window.open()函数实现ExtJS5的登陆页面跳转

    本文地址:http://blog.csdn.net/sushengmiyan/article/details/40427543 mvvm方式实现登陆的博客:http://blog.csdn.net/s ...

  3. [ExtJS5学习笔记]第二十四节 Extjs5中表格gridpanel或者表单数据后台传输remoteFilter设置

    本文地址:http://blog.csdn.net/sushengmiyan/article/details/39667533 官方文档:http://docs.sencha.com/extjs/5. ...

  4. [ExtJS5学习笔记]第十九节 Extjs5中通过设置form.Panel的FieldSet集合属性控制多个field集合

    本文地址:http://blog.csdn.net/sushengmiyan/article/details/39209533 官方例子:http://docs.sencha.com/extjs/5. ...

  5. [ExtJS5学习笔记]第十六节 Extjs5使用panel新增的ViewModel属性绑定数据

    本文地址:http://blog.csdn.net/sushengmiyan/article/details/39078627 sencha官方API:http://docs.sencha.com/e ...

  6. [ExtJS5学习笔记]第二十八节 sencha ext js 5.1.0发布版本正式发布 extjs doc下载地址

    本文地址:http://blog.csdn.net/sushengmiyan/article/details/41911539 本文作者:sushengmiyan ------------------ ...

  7. [ExtJS5学习笔记]第二十节 Extjs5配合数组的push方法,动态创建并加载组件

    本文地址:http://blog.csdn.net/sushengmiyan/article/details/39226773 官方例子:http://docs.sencha.com/extjs/5. ...

  8. [ExtJS5学习笔记]第十四节 Extjs5中data数据源store和datapanel学习

    本文地址:http://blog.csdn.net/sushengmiyan/article/details/39031383 sencha官方API:http://docs.sencha.com/e ...

  9. [ExtJS5学习笔记]第十五节 Extjs5表格显示不友好?panel的frame属性在作怪

    本文地址:http://blog.csdn.net/sushengmiyan/article/details/39057243 sencha官方API:http://docs.sencha.com/e ...

随机推荐

  1. [JSOI 2008]最大数

    Description 题库链接 给你一个序列,初始为空.资瓷下列操作: 在序列末尾加上一个数: 查询后 \(L\) 个数中的最大值. 操作总数为 \(m\) , \(1\leq m\leq 2000 ...

  2. [POJ 3243]Clever Y

    Description Little Y finds there is a very interesting formula in mathematics: XY mod Z = K Given X, ...

  3. wows

    [问题描述]山山最近在玩一款游戏叫战舰世界(steam 游戏太少了),他被大舰巨炮的魅力折服,于是山山开了一局游戏,这次发现目标是一艘战列舰新墨西哥级,舰桥很高,原本应该打在目标身后的圆形水域内的炮弹 ...

  4. 【USACO】 录制唱片

    题目描述 贝西想从奶牛摇滚乐队的 N 首歌里挑出一些录制一套专辑.专辑分 K 张唱片,每张唱片可容纳总长为 C 分钟的歌曲.第 i 首歌的长度为 T i 分钟,录制唱片时,唱片之间的歌曲需要保持原本的 ...

  5. bzoj 1974: [Sdoi2010]代码拍卖会

    Description 随着iPig在P++语言上的造诣日益提升,他形成了自己一套完整的代 码库.猪王国想参加POI的童鞋们都争先恐后问iPig索要代码库.iPi g不想把代码库给所有想要的小猪,只想 ...

  6. linux tracepoint用法【转】

    转自:https://blog.csdn.net/u014089131/article/details/73907995 在kernel中经常会看到trace_XX形式的函数,但是又找不到它的定义. ...

  7. Thinkphp中的A 函数(Thinkphp3.2.3版本)

    A函数是TP中实例化控制器的一个快捷函数,它的语法结构如下: A('模块/控制器') //当控制器层名称不是 Controller 时须这样写 A('模块/控制器','控制器层名称') 如果要调用的控 ...

  8. Vegas Pro 15软件界面对比

    大家都知道Vegas是一款专业的视频制作软件,而新版的VEGAS Pro 15更是专业性十足.好了,废话不多说,接下来小编就带大家具体的看一下Vegas 15界面都有哪些更新吧! 一.软件图标 图1: ...

  9. Postgresql查询最近12个月、最近30天数据

    -- 最近 12 个月 SELECT * FROM 表名 WHERE 日期字段 BETWEEN (now() - INTERVAL '12 months') AND now() -- 最近 30 天 ...

  10. 小程序敏感信息解密-java

    /** * AES解密 * @param content 密文 * @return * @throws InvalidAlgorithmParameterException * @throws NoS ...