Ext 中combo的用法


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,
width: 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: { width: 200 },

转载于:https://www.cnblogs.com/hqyj/p/6635108.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值