如何在不选择下拉菜单的情况下折叠/关闭组合框?
Posted
技术标签:
【中文标题】如何在不选择下拉菜单的情况下折叠/关闭组合框?【英文标题】:How collapse/close Combox without selected on dropdown menu? 【发布时间】:2014-08-22 06:35:47 【问题描述】:代码:
window.combox_search_where = new Ext.form.ComboBox(
typeAhead: true,
lazyRender:true,
fieldLabel: 'Где',
forceSelection: true,
triggerClass: 'arrow_start',
style: 'margin-left:-70px;margin-top:20px;',
width: 270,
labelStyle: 'font-weight:bold;text-align:left;padding-top:20px;padding-left:0px;width:55px;',
store:new Ext.data.SimpleStore(fields:[],data:[[]]),
editable:false,
mode: 'local',
resizable: true,
triggerAction:'all',
tpl: '<tpl for="."><div style="height:200px"><div id="search_tree1"></div></div></tpl>',
);
window.search_tree1 = new Ext.tree.TreePanel(
loader: new Ext.tree.TreeLoader(dataUrl:'layers.php?param=2'),
rootVisible: false,
border:false,
root:new Ext.tree.AsyncTreeNode(text: 'treeRoot',id:'0')
);
search_tree1.on(
'expandnode': function(node)
combox_search_where.expand();
,
'collapsenode': function(node)
combox_search_where.expand();
,
'load': function(node)
search_tree1_filter.filterBy(function(n)
return n.text!='Дополнительные' && n.id!='3dbuild2';
);
search_tree1.expandAll();
search_tree1.collapseAll();
);
var search_tree1_filter=new Ext.tree.TreeFilter(search_tree1,
clearBlank : true,
autoClear : true
);
combox_search_where.on(
'expand':function(combo)
search_tree1.render('search_tree1');
);
在 treePanel 和其他中选中节点后,组合框折叠/关闭。我需要在 treePanel 上没有事件的折叠/关闭组合框(点击触发组合框或模糊或其他)。
【问题讨论】:
【参考方案1】:我的回答(我不知道这个问题之前):
var search_flag_combox1=0;
search_tree1.on(
'click':function(node)
search_flag_combox1=1;
,
'checkchange': function(node,checked)
search_flag_combox1=1;
,
'beforeexpandnode': function(node)
search_flag_combox1=1;
,
'beforecollapsenode': function(node)
search_flag_combox1=1;
,
'load': function(node)
search_tree1_filter.filterBy(function(n)
return n.text!='Дополнительные' && n.id!='3dbuild2';
);
search_tree1.expandAll();
search_tree1.collapseAll();
);
var search_tree1_filter=new Ext.tree.TreeFilter(search_tree1,
clearBlank : true,
autoClear : true
);
combox_search_where.on(
'expand':function(combo)
search_tree1.render('search_tree1');
,
'collapse': function(combo)
if (search_flag_combox1==1)
combox_search_where.expand();
search_flag_combox1=0;
);
有人知道吗?
【讨论】:
以上是关于如何在不选择下拉菜单的情况下折叠/关闭组合框?的主要内容,如果未能解决你的问题,请参考以下文章
如何在不使用Select类的情况下从Dropdown中选择值,因为我的下拉列表框中的列表框未选中?
从子表单的组合框中选择下拉菜单后,MS Access 在主表单中填写 ID