javascript - Extjs 现代工具包 6.5.2 Triton 绑定多选字段
问题描述
我试图在现代工具包中模拟经典工具包中存在的标签字段,我找到了两种方法:
和
我以这种方式使用了这两种方式:
{
xtype:'multiselectfield', //tagfield
multiSelect: true,
displayField: 'name',
required: true,
store: [
{ name: 'Peter', age: 26 },
{ name: 'Ray', age: 21 },
{ name: 'Egon', age: 24 },
{ name: 'Winston', age: 24 }
],
label : 'People'
}
第一个自定义字段用于显示我商店中的数据,但我没有绑定选定的值。
第二个抛出了一些错误,当修复它们时它根本没有显示我商店中的任何值,所以我没有机会绑定选定的值。
所以我想知道如何将多选字段中的选定值与我的 viewModel 绑定。这是我的小提琴:https ://fiddle.sencha.com/#view/editor&fiddle/2lf0
解决方案
选择如下:
{
xtype: 'tagfield',
itemId: 'tagfield',
multiSelect : true,
displayField: 'name',
valueField: 'id',
bind: {
label: '{i18n.topic.topics} ',
store: '{topics}',
selected: '{record.topics}'
},
}
推荐阅读
- xml - 如何避免将 xmlns 命名空间属性传递给 XSLT 中的子元素?
- buildbot - 如果 buildbot 失败,我如何重做一个步骤?
- angular - 如何在 Angular 9 中使用自定义验证器
- tomcat - 服务器重启时如何保持会话?
- java - 故障转储字符串中的 L 和 IL 是什么意思?
- amazon-cloudformation - 配置 Cognito 用户池以在 ap-southeast-2 上使用 SES 发送电子邮件
- javascript - InAppBrowser 无法显示确认和警报
- powershell - 如何分批运行 PowerShell JOB 10 项,完成后进入下 10 项?
- python - 有什么方法可以在我已经创建 concat 文件的同一个 py 文件中工作?
- c++ - getopt_long_only 在第二次调用时返回 -1