问题
I want to use a combobox which receives the preselected value from a data binding and also the possible options from a data binding of the same store. The panel items configuration looks like this:
{
xtype: 'combobox',
name: 'language_default',
fieldLabel: 'Default Language',
multiSelect: false,
displayField: 'title',
valueField: 'language_id',
queryMode: 'local',
bind: {
value: '{database.language_default}',
store: '{database.languages}'
}
}
If I use this configuration, the store of the combobox is invalid and unuseable.
Is it possible to bind the selected option and also the available options of a combobox?
回答1:
Upgrade to ExtJs 5.0.1 and you can use selection binding
{
xtype: 'combobox',
name: 'language_default',
fieldLabel: 'Default Language',
multiSelect: false,
displayField: 'title',
valueField: 'language_id',
queryMode: 'local',
bind: {
value: '{database.language_id}',
selection: '{database.language_default}',
store: '{database.languages}'
}
}
来源:https://stackoverflow.com/questions/25264896/how-to-use-ext5-combobox-with-data-bindings