xtype: 'combo',
tpl: '<tpl for="."><div ext:qtip="{DName}" class="x-combo-list-item">{DRIVER_NAME}</div></tpl>',
fieldLabel: ' 驾驶员名称<font color="red">*</font>',
id: 'cdriverid',
name: 'DriverNameList',
hiddenName: 'DriverNameList',
forceSelection: true,
store: AddDriverStore,
displayField: 'DRIVER_NAME',
valueField: 'DRIVER_ID',
onSelect: function (record, index) {
if (this.fireEvent('beforeselect', this, record, index) !== false) {
record.set('check', !record.get('check'));
var str = [];
var strvalue = [];
this.store.each(function (rc) {
if (rc.get('check')) {
str.push(rc.get('DRIVER_NAME'));
strvalue.push(rc.get('DRIVER_ID'));
}
});
//alert(this.store.getAt(index).get("DRIVER_ID"));
this.setValue(str.join());
this.value = strvalue.join();
Ext.getCmp('selectDriver').setValue(strvalue.join());
this.fireEvent('select', this, record, index);
}
}var vehicleEditWin = new Ext.Window({
layout: 'fit',
width: 660,
modal: 'true',
title: '编辑车辆',
items: AddVehicleForm,
listeners: {
"show": function () {
AddVehicleForm.getForm().reset();
AddVehicleForm.getForm().loadRecord(row[0]); var driverIdList = row[0].data.DRIVERID;
var arrTemp = new Array();
var dirverCombo = Ext.getCmp('cdriverid');
var store = dirverCombo.getStore();
if (driverIdList != "" && driverIdList.substr(0, 1) == ",") {
driverIdList = driverIdList.substr(1, driverIdList.length - 1);
}
var idList = driverIdList.split(',');
var str = [];
var strvalue = [];
for (var i = 0; i < idList.length; i++) {
store.each(function (rc) {
if (rc.get('DRIVER_ID') == idlist[i]) {
rc.set('check', !rc.get('check'));
}
if (rc.get('check')) {
str.push(rc.get('DRIVER_NAME'));
strvalue.push(rc.get('DRIVER_ID'));
}
});
} dirverCombo.setValue(str.join());
dirverCombo.value = strvalue.join();
Ext.getCmp('selectDriver').setValue(driverIdList); }
}
})
vehicleEditWin.show();
如题,代码已贴,这是编辑也面,要实现下拉列表选中多个默认值,ExtJScombo选中多个默认值
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货