Extjs 下拉树 单击+会隐藏下拉树问题

来源:互联网 发布:店铺效果图制作软件 编辑:程序博客网 时间:2024/06/02 04:01
 

问题:单击+会隐藏下拉树问题

解决:重载ComboBox

Ext.override(Ext.form.ComboBox, {
onViewClick : function(doFocus) {
var index = this.view.getSelectedIndexes()[0], s = this.store, r = s.getAt(index);
if (r) {
this.onSelect(r, index);
} else if (s.getCount() === 0) {
this.collapse();
}
if (doFocus !== false) {
this.el.focus();
}
}
});

/******************下拉树************************/

var comboxWithTree = new Ext.form.ComboBox({
fieldLabel:'合同类型<span style="color:red;">*</span>',
labelSeparator: '',
store:new Ext.data.SimpleStore({fields:[],data:[[]]}),
editable:false,
shadow:false,
collapsible: true,
mode: 'local',
triggerAction:'all',
anchor:'90%',
allowBlank:false,
listWidth:270,
width: 200,
resizable: true,
tpl: '<tpl for="."><div><div id="htlx_tree"></div></div></tpl>',
selectedClass:'',
onSelect:Ext.emptyFn
});
var htlx_tree = new Ext.tree.TreePanel({
title: '合同类型',
autoScroll: true,
height: 200,
rootVisible: false,
loader: new Ext.tree.TreeLoader({
dataUrl:'/s?sname=ContractExtServlet',
baseParams:{_resptype:'json',_oper:'doGetContract_FL_Tree'}
}),
root: new Ext.tree.AsyncTreeNode({
//nodeType: 'async',
//text: '合同分类',
draggable: false,
id: '-',
lxmc:'合同分类',
lxdm:''
}),
setValue: function(node){
if (typeof node == "object") {
this.setRawValue(node.text);
if (this.hiddenField) {
this.hiddenField.value = node.id;
}
}else {
this.setRawValue(node);
}
}
});
htlx_tree.on('click',function(node){
lxdm=node.attributes['lxdm'];
if(node.attributes['leaf']=='true'){
comboxWithTree.setValue(node.attributes['lxmc']);
comboxWithTree.collapse();
}
});
comboxWithTree.on('expand',function(){
htlx_tree.render('htlx_tree');
});
// comboxWithTree.render('comboxWithTree');

原创粉丝点击