我有一个组合框。当我尝试搜索名称时,我输入的值会自动消失,并且搜索没有正确进行。 但是,如果我从下拉列表中进行选择,那么它可以正常工作。
问题:
我尝试了typeAhead,但它不起作用。
代码:
xtype: 'combobox',
itemId: 'abc_VendorName',
inputId: 'abc_VendorName',
cls: 'FieldLabel',
margin: '0 0 3 0',
fieldLabel: 'Vendor Name:',
labelSeparator: '',
msgTarget: 'side',
displayField: 'namewithSLID',
valueField: 'code',
matchFieldWidth: false,
forceSelection: true,
enableKeyEvents: true,
minChars: 1,
pageSize: 25,
listeners: {
change: 'onVendorNameChange',
blur: 'onVendorNameBlur'
},
两个听众-
onVendorNameChange: function (combo, newValue, oldValue, eOpts) {
var me = this;
var view = me.getView();
var viewmodel = me.getViewModel();
if (combo.getValue() > 0) {
var selectedRecord = combo.selection;
if (selectedRecord == null || selectedRecord === undefined) {
return;
}
var alias = selectedRecord.get('abbreviation');
var finslCode = selectedRecord.get('code');
view.down("#dspl_VendorAlias").setValue(alias);
viewmodel.get('theRecord').set('finslAbbreviation', selectedRecord.get('abbreviation'));
viewmodel.get('theRecord').set('finslSLID', selectedRecord.get('slid'));
me.implementVendorItemMarkup(finslCode);
}
},
onVendorNameBlur: function (combo, event, eOpts) {
var me = this;
var view = me.getView();
var viewmodel = me.getViewModel();
if (combo.getValue() == null) {
view.down("#dspl_VendorAlias").setValue(null);
viewmodel.get('theRecord').set('finslAbbreviation', null);
viewmodel.get('theRecord').set('finslSLID', null);
}
},