6 Replies Latest reply: Nov 23, 2012 7:58 AM by 975896 RSS

    Tree with context menu not expanding on page load

    677406
      Hi

      I'm using a tree region with Apex 4.0. I have added the jsTree context menu plugin with the javascript as it is desribed here [http://jastraub.blogspot.com/2010/09/adding-context-menu-to-tree-region.html].

      After that, some Apex specific functions don't work anymore: the tree does not expand on page load and no node is selected on page load. The tree looses its template as it was assigned with the application builder.
      I've tried to expand and select the tree programmatically using other plugins of the jstree library (ui, core), but I could not get it to work.

      How is jsTree integrated into Apex? Are all plugins of jsTree available and usable as if I were importing the library by myself (or is it an "adapted" library with less/other functionality)? Is there any documentation on that?

      How can I add a context menu to the tree without loosing the Apex specific functions, as node selection an tree expanding on page load?

      Rgs
        • 1. Re: Tree with context menu not expanding on page load
          524570
          I have exactly the same problem. After implementing the context-sensitive menu from Mr. Straub, everything else works, including the buttons, but I can no longer expand the tree by double-clicking the arrow. I believe its something within the javascript that executes when Page Loads, and may have to do with the "opening" of a hard-coded number. I tried to adapt to my root node, and it gave me one more tree level and that was it ... I wish someone could respond.

          Gerald
          • 2. Re: Tree with context menu not expanding on page load
            Senthil
            Anyone found a solution yet? I have similar problem. When setting opened value to id of tree causes it to open up the tree only one level. Trying to open 2nd level node does not respond.

            Thanks in advance,
            Senthil
            • 3. Re: Tree with context menu not expanding on page load
              Erik_NL
              Did you find a solution for this problem? I got exactly the same problem
              • 4. Re: Tree with context menu not expanding on page load
                DannyC
                Hi,

                I've found a way to get it working but I've absolutely no idea why it works. My JQuery is almost non-existent, so that part is not really surprizing.

                I struggled with this for hours until I finally stumbled across another posting:
                Re: Tree problem

                In it nscglr says how they managed to get it going by duplicating the HTML Header JavaScript. I tried the same and it worked. I finally cut it down to a duplication of just the lTree assignment:

                var lTreeContextMenu={ 
                …
                            var lTree = lTreeSel.tree({  
                              data:{  
                                type:"json",  
                                async:true,  
                                opts:{  
                                  "static":lTreeData,  
                                  isTreeLoaded:false,  
                                  method:"POST",  
                                  url:"wwv_flow.show"  
                                }  
                              },  
                              root:{  
                                draggable:false,  
                                valid_children: "folder"  
                              },  
                              folder:{  
                                valid_children: "file"  
                              },  
                              file:{  
                                valid_children: "none",  
                                max_children: 0,  
                                max_depth:0  
                              },  
                              opened:["0000000"],  
                              plugins:{contextmenu:lTreeContextMenu}  
                              });
                // And again
                            var lTree = lTreeSel.tree({  
                              data:{  
                                type:"json",  
                                async:true,  
                                opts:{  
                                  "static":lTreeData,  
                                  isTreeLoaded:false,  
                                  method:"POST",  
                                  url:"wwv_flow.show"  
                                }  
                              },  
                              root:{  
                                draggable:false,  
                                valid_children: "folder"  
                              },  
                              folder:{  
                                valid_children: "file"  
                              },  
                              file:{  
                                valid_children: "none",  
                                max_children: 0,  
                                max_depth:0  
                              },  
                              opened:["000000000"],  
                              plugins:{contextmenu:lTreeContextMenu}  
                              });
                …


                I also found that the ‘opened’ value need not exist in the tree structure and will render a fully closed tree if it doesn't.

                As I’ve said, I don’t know enough to know why this works, but I figured that it may be of worth to others and someone out there may be able to shed some light on to why this works.

                Nscglr, if you read this, thank you.

                I'm on APEX 4.11 on an 11g instance in case it makes a difference.

                Regards,

                Danny
                • 5. Re: Tree with context menu not expanding on page load
                  Erik_NL
                  that seems like a very weird solution, but I've tried it, and it indeed works!
                  • 6. Re: Tree with context menu not expanding on page load
                    975896
                    Hi

                    It works fine (Thank You) but I cannot hold highlighting current node in Application Express 4.1.1.00.23

                    I try this:

                    var openvalue = html_GetElement('P3_NODE_ACT').value;
                    or
                    var openvalue = document.getElementById('P3_NODE_ACT').value;


                    opened:['openvalue'],
                    or
                    opened:[openvalue],

                    Where 'P3_NODE_ACT' is the selected node page item

                    Regards

                    George