[ExtJS5学习笔记]第二十九节 sencha ext js 5.1.0中动态

页面导航:首页 > 网络编程 > JavaScript > [ExtJS5学习笔记]第二十九节 sencha ext js 5.1.0中动态

[ExtJS5学习笔记]第二十九节 sencha ext js 5.1.0中动态

来源: 作者: 时间:2016-02-05 11:06 【

好了,现在更改下main js中的一点代码,增加如下内容到panel中:,{ xtype: 39;combo 39;, width: 39;100 39;,labelWidth: 39;40 39;,fieldLabel: 39;The

 

 

好了,现在更改下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',
        : '
  • This area is commonly used for navigation, for example, using a tree component.
', 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: '

Content appropriate for the current navigation.

' }] }] }); /

 

/

纠结了很久的问题终于释怀了。之前看的都是使用swapstylesheet我一直么有成功过。偶尔看的了这篇文章,觉得不错,果真成功了。

 

 

Tags:

文章评论

最 近 更 新
热 点 排 行
Js与CSS工具
代码转换工具

<