本文地址: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. 【实验吧】CTF_Web_简单的SQL注入之1

    题目链接:http://ctf5.shiyanbar.com/423/web/ 简单的SQL注入之1,比2,3都简单一些.利用2 的查询语句也可以实现:1'/**/union/**/select/** ...

  2. sublime下让代码居中

    sublime在默认情况下当屏幕写满后只能在底端进行输入,对于我这种强迫症患者来说总想着让代码居中显示,在自己查阅相关sublime配置后进行改动. 点击:preference → setting,进 ...

  3. hihocoder——1041国庆出游(搜索)

    描述 小Hi和小Ho准备国庆期间去A国旅游.A国的城际交通比较有特色:它共有n座城市(编号1-n):城市之间恰好有n-1条公路相连,形成一个树形公路网.小Hi计划从A国首都(1号城市)出发,自驾遍历所 ...

  4. Python SMTP邮件发送

    SMTP是发送邮件的协议,Python内置对SMTP的支持,可以发送纯文本邮件.HTML邮件以及带附件的邮件. Python对SMTP支持有smtplib和email两个模块: email负责构造邮件 ...

  5. [ Java学习基础 ] Java的继承与多态

    看到自己写的东西(4.22的随笔[ Java学习基础 ] Java构造函数)第一次达到阅读100+的成就还是挺欣慰的,感谢大家的支持!希望以后能继续和大家共同学习,共同努力,一起进步!共勉! ---- ...

  6. vue-cli中配置sass

    第一步, npm install node-sass --save-dev npm install sass-loader --save-dev 第二部,打开webpack.base.config.j ...

  7. 解决使用web开发手机网页关于分辨率被缩放的坑

    问题的产生 因为各方面原因,要用网页做界面,开发一个APP.内核使用的是腾讯的x5内核. 把外壳交给前端和设计测试的时候,都汇报:状态栏的颜色太不搭配了,要求可修改 遂启用了安卓4.4版本开始支持的沉 ...

  8. 深入理解Oracle中的随机函数

    --Oracle中取随机值的函数 .dbms_random包 dbms_random包提供了一系列的随机值获取函数以及相关存储过程.下面详细讲解常用的函数和过程. ()dbms_random.rand ...

  9. Python练习之pillow

    此系列意在记录于一些有趣的程序及对其的总结. 问题来源: https://github.com/Yixiaohan/show-me-the-code https://github.com/HT524/ ...

  10. Page2

    css样式表嵌入网页的4种方法: 定义标记的style属性 <标记 style="样式属性:属性值:..;"> 嵌入外部样式表 <style type=" ...