`
y1d2y3xyz
  • 浏览: 252523 次
  • 性别: 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.grid.EditorGridPanel

    此文档是可编辑表格Ext.grid.EditorGridPanel的说明以及示例的源代码,放到eclipse里面即可运行,显示出效果!

    EXT核心API详解

    73、Ext.grid.EditorGridPanel类 ……… 62 74、Ext.grid.PropertyGrid类 …………… 65 1、Ext类 addBehaviors(Object obj) : void 对选择的元素 应用事件侦听器,事件名以@附加在结尾,例如 addBehaviors({ ...

    Ext.grid.GridPanel右键菜单

    右键菜单的资料,代码已经详细描写。请仿照文件中所描述即可使用,不限于EXT4.0以上版本使用。

    ExtJS入门教程(超级详细)

    1、Ext类 ………………………………… 2 2、Array类 …………………………… 4 3、Number类 …………………………… 4 4、...73、Ext.grid.EditorGridPanel类 ……… 62 74、Ext.grid.PropertyGrid类 …………… 65

    给Extjs的GridPanel增加“合计”行

    NULL 博文链接:https://tonylian.iteye.com/blog/1735525

    Ext可编辑的tree,EditorGridPanel

    因为项目的需求,实现一个可以编辑的tree,在网上找了一个牛人写的控件.Ext.ux.maximgb.tg.EditorGridPanel 把源码下载下来以后 不能运行,自己根据给出的列子,另写了一个小程序.不过并没有与数据库交互.

    Ext 3.2的一个TreeGrid

    感谢 Ericzhen 远离颠倒梦想,蕴籍无上清凉 这里引用它的资源 仅作分享 http://www.cnblogs.com/Ericzhen/archive/2012/06/11/2545186.html

    Extjs EditorGridPanel中ComboBox列的显示问题

    为了解决这个问题需要在EditorGridPanel的ColumnModel中显示ComboBox的地方使用renderer属性,重新渲染,方法如下: 代码如下: //部门列表 var comboxDepartmentStore = new Ext.data.Store({ proxy: new Ext.data....

    ExtJS下grid的一些属性说明

    1.界面修改(css style): Extjs中界面风格与我们产品本身的风格有很大不同,从边框、... 属性的作用(About Ext.grid. GroupingView, EditorGridPanel): Extjs的grid功能强大,如排序、隐藏列或移动列等,这些都有一些属

    ext 读取xml 可编辑grid

    ext 数据对象的定义 EditorGridPanel的使用 ext读取xml ext对各种数据格式的支持

    GridPanel属性详解

    详细介绍GridPanel各项属性,ExtJS 普通表格:Ext.grid.GridPanel属性详解

    extjs实例与学习资料

    因为前段时间有两个专案要用到extjs技术,所以自己学了一段...grid,tree,显示树信息的TreePanel、用于显示表格的GridPanel及EditorGridPanel,还有代表应用程序窗口的Ext.Window,与数据库交付,希望对初学者带来帮助

    Extjs可编辑的EditorGridPanel

    NULL 博文链接:https://zxf-noimp.iteye.com/blog/629629

    解决editorgridpanel编辑时视图向右移动的问题

    NULL 博文链接:https://fourfire.iteye.com/blog/355853

    ExtJs2.0简明教程

    ………..35 第六章 使用表格控件Grid……….………………………………………………………………………………..……36 6.1 基本表格GridPanel……….…………………………………………………………………………...

    extjsnaction

    1 A framework apart 2 Back to the basics 3 Events, Components, and Containers ...8 The EditorGridPanel 9 Taking root with Trees 10 Toolbars and Menus 11 Drag and drop with Widgets

    EXTJS 学习笔片段1

    Grid EditorGridPanel 使用本地store Toolbar工具菜单创建 分页工具栏创建 Window 弹出处理window窗口(模态窗口) MessageBox show(报错窗口、保存提示、选择窗口) alert prompt 实用工具类 JS异常捕捉 ...

    ExtJS 2.0实用简明教程

    6)Ext类库简介 7)Border区域布局 8)ExtJS的组件 9)Column列布局 10)组件的使用 11)Fit布局 12)Form布局 13)组件的配置属性 14)Accordion布局 15)事件处理 16)Card布局 17)Pable布局及其它布局 18)工具栏Toolbar 19)...

Global site tag (gtag.js) - Google Analytics