[ExtJS5 Study Notes] section 29th sencha ext js 5.1.0 dynamically changes skin themes

Source: Internet
Author: User

[ExtJS5 Study Notes] section 29th sencha ext js 5.1.0 dynamically changes skin themes

 

 

Now, change the code in main. js and add the following content to the panel:

 

, {Xtype: 'combo ', width: '20140901', 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 theme'}, {value: 'neptune-touch', name: 'neptune touch theme '}, {value: 'crisp', name: 'crisp theme '}, {value: 'crisp-touch ', Name: 'crisp Touch theme '}, {value: 'classic', name: 'classic theme '}, {value: 'Gray', name: 'Gray theme '}]}), // value: theme, listeners: {select: function (combo) {var theme = combo. getValue (); varhref = 'ext/packages/ext-theme-'+ theme +'/build/resources/ext-theme-'{theme}'-all.css '; varlink = ext. fly ('Theme '); if (! Link) {link = Ext. getHead (). appendChild ({tag: 'link', id: 'Theme ', rel: 'stylesheet', href: ''}) ;}; link. set ({href: Ext. string. format (href, theme )});}}}

The main. js code should be as follows: (complete content)

 

 

/** * 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: '
  • This area is commonly used for navigation, for example, using a tree component.
', Width: 250, split: true, tbar: [{text: 'click', handler: 'onclickclickclickclick'}, {xtype: 'combo', width: '123 ', 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 theme'}, {value: 'neptune-tou Ch ', name: 'neptune Touch theme'}, {value: 'crisp ', name: 'crisp theme'}, {value: 'crisp-touch', name: 'crisp Touch theme '}, {value: 'classic', name: 'classic theme '}, {value: 'Gray', name: 'Gray theme '}]}), // 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: 'content appropriate for the current navigation. '}]});

 

After a long struggle, I finally let it go. I have been using swapstylesheet. After reading this article occasionally, I think it's good. It's really successful.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.