本文地址: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. [Codeforces 176B]Word Cut

    Description 题库链接 给你两个字符串 \(S\) 和 \(T\) ,准许你 \(k\) 次操作,每次将字符串左右分成两个非空的部分,再交换位置,问你有多少种不同的操作方法将 \(S\) 串 ...

  2. 【网络流】【BZOJ1006】【SCOI2007】蜥蜴

    学弟@lher在周末训练赛中出的题目的原题(这个人拿省选题来当作提高组模拟,太丧了...) 题意简析:看题目:) 解题思路:题目显然是最大流. 首先拆点将点权变为边权,然后按照题意对于所有有跳板的点向 ...

  3. 2015多校联赛 ——HDU5288(数学)

    OO’s Sequence Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) ...

  4. bzoj 1880: [Sdoi2009]Elaxia的路线

    Description 最近,Elaxia和w的关系特别好,他们很想整天在一起,但是大学的学习太紧张了,他们 必须合理地安排两个人在一起的时间.Elaxia和w每天都要奔波于宿舍和实验室之间,他们 希 ...

  5. APIO2017 懵逼记

    Day -1: 移步http://www.cnblogs.com/juruolty/p/6854795.html Day 0: CTSC铁牌后,下一个就是APIO了. lmy,sxy,cxc,lh过来 ...

  6. Requests库介绍

    Requests 是用Python语言编写,基于 urllib,采用 Apache2 Licensed 开源协议的 HTTP 库.它比 urllib 更加方便,可以节约我们大量的工作,完全满足 HTT ...

  7. python中模块,包,库的概念

    模块:就是.py文件,里面定义了一些函数和变量,需要的时候就可以导入这些模块. 包:在模块之上的概念,为了方便管理而将文件进行打包.包目录下第一个文件便是 __init__.py,然后是一些模块文件和 ...

  8. 解决警告: Setting property 'source' to 'org.eclipse.jst.jee.server_:' did not find a matching property.的方法

    今天第一次搭建struts2框架,跟着网上的教程导入对应的jar包之后就开始写登录的jsp页面,但是运行时出现了问题, 浏览器显示"The requested resource is not ...

  9. 模仿天猫实战【SSM版】——项目起步

    前言:现在自己的学习似乎遇到了瓶颈,感觉学习了 SSM 之后有一些迷茫,不知道接下来该往哪里去努力了,我觉得这是个很不好的状态,为了度过这段时期,我准备把天猫模仿下来(给自己找点事做)之后开始去巩固 ...

  10. Java数据库开发(一)之——JDBC连接数据库

    一.MySQL数据库 1.创建数据库 CREATE DATABASE jdbc CHARACTER SET 'utf8'; 2.建表 CREATE TABLE user ( id int(10) NO ...