【发布时间】:2018-02-20 22:58:23
【问题描述】:
我将下面的代码用于 10 个字段,但我想让我的 5 个字段显示(缩写 - 名称),另一个只显示(缩写)我如何达到这个目标。 注意:此代码来自http://docs.sencha.com/extjs/4.1.1/#!/api/Ext.form.field.ComboBox
提前致谢,
var states = Ext.create('Ext.data.Store', {
fields: ['abbr', 'name'],
data : [
{"abbr":"AL", "name":"Alabama"},
{"abbr":"AK", "name":"Alaska"},
{"abbr":"AZ", "name":"Arizona"}
]
});
Ext.create('Ext.form.ComboBox', {
fieldLabel: 'Choose State',
store: states,
queryMode: 'local',
valueField: 'abbr',
renderTo: Ext.getBody(),
// Template for the dropdown menu.
// Note the use of "x-boundlist-item" class,
// this is required to make the items selectable.
tpl: Ext.create('Ext.XTemplate',
'<tpl for=".">',
'<div class="x-boundlist-item">{abbr} - {name}</div>',
'</tpl>'
),
// template for the content inside text field
displayTpl: Ext.create('Ext.XTemplate',
'<tpl for=".">',
'{abbr} - {name}',
'</tpl>'
)
});
【问题讨论】:
-
你应该如何确定哪些项目显示哪些显示值?
标签: javascript extjs extjs4.1