`
y1d2y3xyz
  • 浏览: 260215 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

Ext.grid.EditorGridPanel 中combo的显示异常

阅读更多
Ext.grid.EditorGridPanel 在项目中用到Ext的这个组件,但发现在这个组件中添加editor的类型为combo的时候有点小问题,如果单纯的从combo来讲设置valueField和displayField值为对应的字段名就OK了,但在Ext.grid.EditorGridPanel的editor中,怎么设置最后显示的都是valueField,我百度了一下,很多同学也遇到了这样的问题,但看到很多的解决方法都不行,也不知道是EXTJS的版本导致的,还是大家也文章的时候根本没测试!最后还是得求google大神了,一用到这些东西的时候,我也不得不叹一口气:‘百度和google比起来还是那么的山寨!’

看代码:
//这是combo是store部分
var sexStore =new Ext.data.ArrayStore({
	fields: ['valField','displayText'],
	data: [['0','男'],['1','女']]//配置文件中的值
     }),

//下面是应用的组件代码,
{
	header:"性 别",
	dataIndex:'Sex',
	width:50,
        //核心的东西在这里,记得看这里面的指端要和editor中的字段对应,
        //我觉得这个问题是Extjs的一个BUG,单独用没问题,
	renderer:function(value, metaData, record, rowIndex, colIndex, store) {
		var idx = sexStore.find("valField", value);
		return (idx != "-1") ? sexStore.getAt(idx).data.displayText : '';
	},
	editor:{
		xtype: 'combo',
		typeAhead: true,
		triggerAction: 'all',
		lazyRender:true,
		mode: 'local',
		allowBlank:false,
		forceSelection:true,
		editable:false,
		store: sexStore ,
		valueField: 'valField',
		displayField: 'displayText'
	}
}



可以看这里 http://www.sencha.com/forum/showthread.php?67442-ComboBox-display-displayField-instead-of-valueField
分享到:
评论

相关推荐

    Ext组件描述,各个组件含义

    **2.5 Editor Grid Panel (Ext.grid.EditorGridPanel)** - **xtype**: `editorgrid` - **功能描述**:Editor Grid Panel 是一个支持行级编辑的网格面板。 - **主要用途**:适合于需要对表格中的数据进行编辑的场景...

    ExtJS3总结内容

    - `editorgrid`: `Ext.grid.EditorGridPanel` - `flash`: `Ext.FlashComponent` - `grid`: `Ext.grid.GridPanel` - `listview`: `Ext.ListView` - `panel`: `Ext.Panel` - `progress`: `Ext.ProgressBar` - `...

    ExtJs组件类的对应表

    11. **`editorgrid`** - `Ext.grid.EditorGridPanel`,可编辑的表格组件,允许用户直接在表格中编辑数据。 12. **`propertygrid`** - `Ext.grid.PropertyGrid`,属性表格组件,用于展示对象的属性。 13. **`...

    extJs xtype 类型

    11. **`editorgrid`:** 可编辑的表格组件,允许用户直接在表格中编辑数据,通过`Ext.grid.EditorGridPanel`类实现。 12. **`propertygrid`:** 属性表格组件,用于展示对象的属性列表,通过`Ext.grid.PropertyGrid`...

    ExtJs xtype一览

    - **`editorgrid` (Ext.grid.EditorGridPanel)**: 可编辑的表格组件,允许用户直接在表格内进行数据编辑。 - **`propertygrid` (Ext.grid.PropertyGrid)**: 属性表格组件,专门用于展示对象的属性。 - **`editor` ...

    Extjs xtype集合

    - **`Class`**: `Ext.grid.EditorGridPanel` - **描述**: 可编辑的表格组件,允许用户直接在表格中编辑数据。 12. **`propertygrid`:** - **`xtype`**: `propertygrid` - **`Class`**: `Ext.grid.PropertyGrid...

    学习ExtJS Panel常用方法

    - `editorgrid`: `Ext.grid.EditorGridPanel` - `flash`: `Ext.FlashComponent` - `grid`: `Ext.grid.GridPanel` - `listview`: `Ext.ListView` - `panel`: `Ext.Panel` - `progress`: `Ext.ProgressBar` - `...

Global site tag (gtag.js) - Google Analytics