//combox树
ComboTree: function (upDep, empStore) {
var com = Ext.create('Ext.ux.desktop.ComboTree', {
margin: '0 0 5 5',
labelWidth: 60,
//rootText: 'text',
emptyText: '请选择部门...',
flex: 3,
rootId: 'id',
expanded: true,
storeUrl: '/data/personMatter/orgHandler.ashx?Action=tree',
editable: false,
name: 'depname',
value: upDep,
id: 'CommonUp_Add_From',
selectMode: 'all',
treeHeight: 300,
listeners: {
select: function (Combox, record, index) {//联动效果
var city = Ext.getCmp('emplerId');
city.clearValue();
city.store.removeAll();
depId = record.data.id;
empStore.load({
params: {
action: 'empInDep', depId: record.data.id
}
});
}
}
});
return com;
}, form:
var empStore= Ext.create('Ext.data.Store', {
fields: ['id', 'name'],
proxy: {
type: 'ajax',
url: '/data/CommonHandlers/ComboBoxHandler.ashx',
reader: {
type: 'json',
root: 'items'
}
}
});
{
fieldLabel: '业务员',
labelWidth: 60,
margin: '0 0 5 20',
xtype: 'fieldcontainer',
combineErrors: true,
defaultType: 'textfield',
defaults: {
hideLabel: 'true'
},
layout: 'hbox',
flex: 1,
items: [CusManage.CustomerList.ComboTree('', empStore),
{
emptyText: '请选择员工...',
flex: 2,
selectOnFocus: true,
xtype: 'combobox',
name: 'empler',
margins: '0 0 0 6',
valueField: 'id',
store:empStore,
displayField: 'name',
queryMode: 'local', //4.2以前版本为model,一定看清,否自抓狂
id:'emplerId'
}]
}