gpt4 book ai didi

javascript - ExtJS ComboBox 中的多个字段

转载 作者:行者123 更新时间:2023-12-03 10:01:05 31 4
gpt4 key购买 nike

我有一个包含以下字段的商店:

  • 人物姓名
  • 主要 Angular 色
  • 次要 Angular 色

我想填充一个组合框,以便我可以选择他们的主要或次要 Angular 色。

我当前的组合框代码如下所示:

roleName: {
editor: Ext.create('Ext.form.ComboBox', {
store: persons,
queryMode: 'local',
displayField: 'primaryRole',
valueField: 'primaryRole'
}),
displayName: 'Role'
}

是否可以从两个商店字段填充组合框,如果可以,如何填充?

最佳答案

您可以更新组合框的 tpldisplayTpl 配置以显示您想要的数据。以下是 ExtJS 4 文档中的示例:

// 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 ComboBox 中的多个字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30597589/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com