Extjs4,如何在组合编辑器中设置displayField? [英] Extjs4, How to set displayField in combo editor?

查看:353
本文介绍了Extjs4,如何在组合编辑器中设置displayField?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在组合编辑器中,选择一个选项后,即使我设置了显示字段,它也会显示值. 单击组合编辑器后,它也会显示displayField,但是在选择并单击其他编辑器后(这意味着将鼠标移出),然后单元格值将更改为valueField.

In combo editor, after select a option, it display value even I set display Field. Once I click the combo editor, it will display displayField as well, but after select and click the others (It means mouse out) then the cell value changed to valueField.

我的组合编辑器代码,

{
   xtype : 'combo',
   editable : false,
   triggerAction : 'all',
   displayField : 'name',
   valueField : 'id',
   store : myStore
}

我错过了什么?

任何人都知道,请告诉我〜

anyone know, please advice me~

谢谢!

我在这里编写测试代码:

I write test code in here :

http://jsfiddle.net/ilovekanon/NQXw9/

更改名称,然后单击其他名称,该名称将显示ID,而不是名称:(

change name and click the others then the name will show ID, not name :(

推荐答案

您的jsFiddle代码没有错.

Your jsFiddle code dose not wrong.

displayField表示组合中显示的数据字段名称. 它不在网格中显示值. 当组合选项处于选中状态时,网格显示选定的值. 如果要在组合商店中显示name,则必须将valueField设置为名称",

displayField in combo is mean that displayed data field name in combo. It's not displayed value in grid. grid display selected value, when selected option in combo. if you want to display name in combo's store, valueField must is set 'name',

因此,如果您需要在combo的商店中标识,则可以设置新的隐藏网格列.更改事件触发时.

So, If you need to id in combo's store, You maybe set new hidden grid column. when change event trigger.

这篇关于Extjs4,如何在组合编辑器中设置displayField?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆