单击组合框中树中的 [+] 时阻止组合框折叠 - extjs 3

发布于 2024-09-27 12:03:39 字数 226 浏览 0 评论 0原文

我已经使用此线程

但是当单击树上的 [+] 或箭头时,组合框会折叠

有什么办法可以阻止这个吗?

请帮助我......非常感谢......

问候

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.......

Regards

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

请持续率性 2024-10-04 12:03:39

这里同样存在问题——我的解决方法是默认显示展开的树。
但这并不能解决箭头的问题......

基本上,当单击树时,组合框会看到“模糊”事件,从而折叠。
但我不知道如何防止这种情况。

顺便说一句,如果有人有一个完全工作的 ExtJS“组合框 + 树”解决方案,那将会非常有帮助。
因为 Sencha 论坛上提供的解决方案非常有限:

  • 组合框的显示和值必须相同(而我希望它的值是树的节点 ID)
  • 没有办法“恢复”值/显示当组合框是表单的一部分时(例如使用“form.loadRecord()”)

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()")
野味少女 2024-10-04 12:03:39

感谢 Pepijn 回答了我的问题。解决方案如下:

您可以使用树的 beforecollapsenode 和 beforeexpandnode 事件来查找它们是否被按下。请参阅下面的代码:

 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;
               }  
             });

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;
               }  
             });
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文