var combobox_xianqu = Ext.getCmp('combobox_id');
var store_xianqu = Ext.data.StoreMgr.lookup('store_xianqu');
var r = store_xianqu.getRange();
combobox_xianqu.fireEvent('select', this, r);
-----------在原store上插入一条数据--------
{
name: 'VARTYPE',
fieldLabel: "Var Type",
xtype: 'combo',
autoSelect: true,
store: 'VarTypeStore',
editable: true,
minChars: 1,
weight: 50,
labelWidth:80,
220,
queryParam: 'COMM_CODE',
typeAhead: false,
queryMode: 'local',
valueField: 'COMM_CODE',
displayField: 'COMM_CODE_NM',
hiddenName: 'COMM_CODE',
margin: '5 5 5 10',
listeners: {
'render': function (com) {
var store = com.getStore();
store.on('load', function (store, record) {
var data = [{
COMM_CODE: '',
COMM_CODE_NM: 'ALL'
}];
if (store.getAt(0).data.Model != 'ALL') {
store.insert(0, data);
com.setValue('');
}
});
}
}
}
----------------------输入字符后查询-------------------------------
{
xtype: 'combo',
fieldLabel: 'Model Code',
columnWidth: .23,
allowBlank: false,
name: 'ModelCode',
store: 'ModelCodeRegisterStore',
editable: true,
enableKeyEvents: true, -------支持键盘
minChars: 30,
typeAhead: true,
queryMode: 'local',
valueField: 'MODEL_CODE',
displayField: 'MODEL_CODE',
listeners: {
keydown: function (th, e, eOpts) {
if (e.keyCode == 13) { ---回车
if (typeof (th.getPicker().pickerField.isExpanded) == 'undefined' || th.getPicker().pickerField.isExpanded == false || (th.getPicker().pickerField.isExpanded == true && typeof (th.getPicker().highlightedItem) == 'undefined')) {
th.store.proxy.extraParams = {
Material: th.up("window").down('checkbox[name=Material]').getValue(),
ModelCode: th.getValue()
};
th.store.load({
callback: function (records, options, success) {
th.expand();
th.focus();
}
});
}
}
}
}
}
--------
{
xtype: 'combo',
flex: .7,
name: 'FromPoint',
forceSelection: false,
value: '',
editable: false,
typeAhead: false,
store: Ext.create("Scripts.Code.MDM.Logistic.Delivery.DeliveryAttribute.store.FromPointStore"),
tpl: Ext.create('Ext.XTemplate',
'<tpl for=".">',
'<div class="x-boundlist-item">{COMM_CODE}:{COMM_CODE_NM}</div>',
'</tpl>'
),
queryMode: 'local',
queryParam: 'COMM_CODE',
valueField: 'COMM_CODE',
displayField: 'COMM_CODE_NM',
hiddenName: 'COMM_CODE',
listeners: {
change: function (combo, newValue, oldValue, eOpts) {
var form = combo.up("form");
form.down("combo[name=ToPoint]").setValue("");
var obj = form.getForm().getValues();
//console.log(obj);
var to_store = Ext.getStore("ToPointStore");
to_store.proxy.extraParams = obj;
to_store.load();
}
}
}
combo设置下拉列表宽度:
matchFieldWidth: false,//此处要有
listConfig: { 200 },