开发者

Stop combobox from collapsing when [+] in tree within combobox is clicked - extjs 3

I have implemented tree within combobox using idea from this thread

but when [+] or arrow on tree is clicked, the combobox collapses

Is there any way to stop this????????

Please help me....Thanks alot.......

Regard开发者_开发百科s


Same problem here -- my workaround is to show the tree expanded by default. Yet that doesn't solve the issue with the arrows...

Basically the combobox sees a "blur" event when clicking on the tree and thus collapses. But I don't know how to prevent that.

By the way, if someone had a fully working "combobox + tree" solution for ExtJS, that would be very helpful. Because the solution provided on the Sencha forums is quite limited:

  • Display and value of the combobox has to be the same (whereas I'd like its value to be the tree's node ID)
  • There's no way to "restore" the value/display of the combobox when it's part of a form (e.g. using "form.loadRecord()")


Thanks for Pepijn who answered my question. Here is the solution:

you can use the tree beforecollapsenode and beforeexpandnode events to find if they are pressed. See the code below:

 tree1.on('click',function(node){
             combo.setValue(node.text);
             nodeAction=0;
             combo.collapse();
           });
tree1.on('beforeexpandnode',function(node,deep,anim){
             nodeAction=1;
            });
tree1.on('beforecollapsenode',function(node,deep,anim){
             nodeAction=1;
            });
combo.on('collapse',function(){
               if(nodeAction==1){
                 this.expand();
                 nodeAction=0;
               }  
             });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜