[ExtJS5 Study notes] 29th section Sencha Ext JS 5.1.0 dynamic Change Skin theme

Source: Internet
Author: User

This address: http://blog.csdn.net/sushengmiyan/article/details/42016107

This article Sushengmiyan

--------------------------------------------------------------------------------------------------------------- ---------------------

For convenience, use Sencha cmd to create a project, use the App build command build project, and start the service using the Web Start command.


OK, now change the bit of code under Main.js and add the following to the panel:

, {        xtype: ' Combo ',        width: ' + ', labelwidth: ' + ', 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 '},{Valu E: ' Crisp ', Name: ' Crisp theme '},{value: ' Crisp-touch ', Name: ' Crisp touch theme '},{value: ' Classic ', Name: ' Classic theme '},{VA Lue: ' 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 look like this: (Full content)

/** * This class was 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 F        Or navigation, for example, using a "tree" component.</li></ul> ', width:250, Split:true, Tbar: [{text: ' Button ', handler: ' OnclicKbutton '},{xtype: ' Combo ', Width: ' + ', labelwidth: ' + ', Fieldlabel: ' Theme ', Displayfield: ' Name ', V Aluefield: ' 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: ' Classi C ', Name: ' Classic theme '},{value: ' Gray ', Name: ' Gray Theme '}]},//value:theme,listeners: {select:function (combo) {var them E = 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)});}}           }]},{region: ' Center ', xtype: ' TabPanel ', items:[{title: ' Tab 1 ', HTML: ' 

The problem that has been tangled for a long time is finally relieved. All I've seen before is the use of Swapstylesheet I have been successful. Occasionally read this article, feel good, indeed success.

http://extjs.eu/lightweight-theming/

Recommended, this site, the content is more substantial, the interface is more beautiful. There are some plugins that need to be paid for.

[ExtJS5 Study notes] 29th section Sencha Ext JS 5.1.0 dynamic Change Skin theme

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.