Combobox 从combo加载表单
我正在尝试从组合中选择的记录加载表单 存储被正确加载,组合被填充,但是,当我从组合中选择一个值时,表单字段仍然为空 任何帮助都将不胜感激 代码如下: 型号: 商店: 类别: 这是针对Combobox 从combo加载表单,combobox,extjs4,Combobox,Extjs4,我正在尝试从组合中选择的记录加载表单 存储被正确加载,组合被填充,但是,当我从组合中选择一个值时,表单字段仍然为空 任何帮助都将不胜感激 代码如下: 型号: 商店: 类别: 这是针对选择事件的: 选择(Ext.form.field.ComboBox组合,数组记录,对象eOpts) 请注意,第二个参数是数组。但在您的示例中,第二个参数是Ext.data.Record。您将数组视为记录。修改您的loadForm,使其能够处理记录数组: loadForm: function (field,record
选择事件的:
选择(Ext.form.field.ComboBox组合,数组记录,对象eOpts)
请注意,第二个参数是数组。但在您的示例中,第二个参数是Ext.data.Record
。您将数组视为记录。修改您的loadForm
,使其能够处理记录数组:
loadForm: function (field,records,option) {
this.down('form').loadRecord(records[0]);
}
顺便说一句,您有两个字段名为:'name'
Ext.define('AA.store.proc.Process', {
extend: 'Ext.data.Store',
model: 'AA.model.proc.Process',
requires: 'AA.model.proc.Process'
});
Ext.define('AA.view.proc.IM', {
extend: 'Ext.window.Window',
alias: 'widget.im',
title: 'IM',
layout: 'fit',
height: 500,
width: 400,
autoShow: true,
plain: true,
modal: true,
headerPosition: 'right',
closable: false,
initComponent: function () {
this.items = [{
xtype: 'form',
fileUpload: true,
width: 550,
autoHeight: true,
border: false,
bodyStyle: 'padding:5px 5px 0',
frame: true,
labelWidth: 100,
defaults: {
anchor: '95%',
allowBlank: false,
msgTarget: 'side'
},
items: [{
xtype: 'combo',
name: 'name',
store: 'procstore',
fieldLabel: 'Name',
valueField: 'name',
displayField: 'name',
width: 150,
allowBlank: true,
listeners: {
scope: this,
'select': this.loadForm
}
}, {
xtype: 'textfield',
fieldLabel: 'Name',
name: 'name'
}, {
xtype: 'textfield',
fieldLabel: 'Owner',
name: 'owner'
}, {
xtype: 'textfield',
fieldLabel: 'E-mail owner',
name: 'mail_dest'
}]
}];
this.buttons = [{
text: 'Save',
action: 'save'
}, {
text: 'Cancel',
scope: this,
handler: this.close
}];
this.callParent(arguments);
},
loadForm: function (field, record, option) {
console.log(record)
// firebug returns
// $className "AA.model.proc.Process"
// $alternateClassName "Ext.data.Record"
console.log(this.down('form'))
// firebug returns the right form panel
this.down('form').loadRecord(record);
}
});
loadForm: function (field,records,option) {
this.down('form').loadRecord(records[0]);
}