ExtJs中Ext.grid.Panel表格行内变下拉框

 废话不多说,直接上代码,最下面讲解注意的问题,

var simpsonsStore =  Ext.create('Ext.data.Store', {
		    storeId: 'simpsonsStore',
		    fields: ['name', 'email', 'phone'],
		    data: [{
		        name: '1',
		        email: '[email protected]',
		        phone: '正序'
		    }, {
		        name: '2',
		        email: '[email protected]',
		        phone: '正序'
		    }, {
		        name: '3',
		        email: '[email protected]',
		        phone: '倒序'
		    }, {
		        name: '4',
		        email: '[email protected]',
		        phone: '正序'
		    }, {
		        name: '5',
		        email: '[email protected]',
		        phone: '正序'
		    }]
		});
		var states = Ext.create('Ext.data.Store', {
		    fields: ['abbr', 'email'],
		    data : [
		        {"abbr":"AL", "email":"Alabama"},
		        {"abbr":"AK", "email":"Alaska"},
		        {"abbr":"AZ", "email":"Arizona"}
		    ]
		});
		var comboBoxOne =  Ext.create('Ext.form.ComboBox', {
		    store: states,
		    queryMode: 'local',
		    displayField: 'email',
		    valueField: 'abbr',
		    renderTo: Ext.getBody()
		});
		var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
	        clicksToEdit: 2
	    });
		var gridPanelTwo = Ext.create('Ext.grid.Panel', {
			store : simpsonsStore,
			columnLines:true,
			rowLines:true,
			columns : [ {
				header : ' ',
				dataIndex : 'name'
			}, {
				header : '指标名称',
				dataIndex : 'email',
				editor:comboBoxOne,
				flex : 1
			}, {
				header : '排序',
				dataIndex : 'phone'
			} ],
			plugins:[cellEditing],
			height : 190,
			width : 400,
			renderTo : Ext.getBody()
		});

看到这篇文章的小伙伴是不是双击没反应啊,那是因为你漏了plugins:【】,这个属性

你可能感兴趣的:(ExtJs)