Javascript ExtJs-基于一个组合框绑定到多个字段
我是ExtJs新手,如果这个问题含糊不清,我很抱歉,我会尽力解释 我有一家商店,如下所示Javascript ExtJs-基于一个组合框绑定到多个字段,javascript,extjs,mvvm,combobox,binding,Javascript,Extjs,Mvvm,Combobox,Binding,我是ExtJs新手,如果这个问题含糊不清,我很抱歉,我会尽力解释 我有一家商店,如下所示 Ext.define('MyApp.store.ValveSystemStore', { extend: 'Ext.data.Store', alias: 'store.valveSystem', fields: [ 'SystemId', 'EquipRef', 'Type' ], proxy: { t
Ext.define('MyApp.store.ValveSystemStore', {
extend: 'Ext.data.Store',
alias: 'store.valveSystem',
fields: [
'SystemId',
'EquipRef',
'Type'
],
proxy: {
type: 'direct',
directFn: 'MyApp.Direct.GetSystems'
}
});
我的模型
Ext.define('MyApp.model.ValveSystem', {
extend: 'Ext.data.Model',
field: [
{ name: 'SystemId', type: 'int' },
{ name: 'Type', type: 'string' },
{ name: 'EquipRef', type: 'string' }
],
idProperty: 'SystemId',
proxy: {
type: 'direct',
api: {
read: 'MyApp.Direct.GetValveSystems'
},
paramOrder: 'id'
}
});
还有我的ViewModel
Ext.define('MyApp.view.SystemViewModel', {
extend: 'Ext.app.ViewModel',
requires: [
'MyApp.store.ValveSystemStore',
'MyApp.model.ValveSystem'
],
alias: 'viewmodel.SystemViewModel',
stores: {
systemStore: Ext.create('MyApp.store.ValveSystemStore', {
model: 'MyApp.model.ValveSystem',
})
}
});
我在“TopPanel”上有一个组合框,其中填充了我的商店中显示的equiref
字段列表。我在它下面有一个面板,上面有一个文本字段,用于equiref
和Type
。当我从组合框中选择一个equiref
时,它会出现在相应的文本字段中。到目前为止,我有一个绑定将equiref
组合框与其文本框链接起来,但是我不知道如何让type
也填充其文本框
顶部面板组合框代码
{
xtype: 'combobox',
width: 200,
fieldLabel: 'Equip Ref',
editable: true,
store: {
type: 'valveSystem',
autoLoad: true
},
queryMode: 'remote',
triggerAction: 'all',
displayField: 'EquipRef',
bind: '{EquipRef}'
}
底部面板文本字段代码
items: [
{
fieldLabel: 'Equip Ref',
xtype: 'textfield',
width: 240,
id: 'equipRef',
bind: '{EquipRef}', // --> works, textfield populated
editable: false
},
{
fieldLabel: 'Type',
xtype: 'textfield',
name: 'type',
bind: '{Type}', // -----> this does not work
editable: false
}
]
我知道这可能是一个业余的问题,我已经对绑定和MVVM体系结构进行了研究,但这里有些东西超出了我的头脑。谢谢你