【发布时间】:2018-08-06 01:34:31
【问题描述】:
我正在尝试创建两个组合框。第一个显示国家名称,第二个显示省/州。这个想法是根据第一个组合的选择过滤第二个组合,并将“VisitingCountryProvince”的值作为默认选择。 下面代码的问题是,它没有根据第一个组合框选择默认值。如果我删除绑定过滤器,第二个组合框会显示正确的“VisitingCountryProvince”值。
有什么想法吗?
{
xtype: 'fieldset',
title: 'Visiting Country',
layout: 'anchor',
anchor: '-10',
collapsible: false,
defaults: {
xtype: 'combo',
labelStyle: 'font-weight: bold;',
flex: 1,
anchor: '0',
editable: false,
forceSelection: true,
allowBlank: false,
emptyText: 'Select...',
queryMode: 'local',
},
items: [{
name: 'VisitingCountry',
fieldLabel: 'Main',
reference: 'visitingCountryFieldRef',
publishes: 'value',
store: {
type: 'arraydropdownstore'
},
valueField: 'value',
displayField: 'value'
}, {
name: 'VisitingCountryProvince',
fieldLabel: 'Sub',
store: {
type: 'array',
fields: ['value', 'countryName']
},
bind: {
filters: {
property: 'countryName',
value: '{visitingCountryFieldRef.value}'
}
},
valueField: 'value',
displayField: 'value'
}]
},
我能找到的最接近问题的答案在这里,How to use combo "publishes" value & bindings to filter store on another combo
我刚刚发现,我可以进行过滤或选择默认值,而不是两者兼而有之。如何从过滤后的列表中过滤和绑定默认值?
【问题讨论】:
标签: extjs sencha-cmd