Loading ...
Sorry, an error occurred while loading the content.

Dynamic Tree

Expand Messages
  • jerry_gagliano
    Ok i have a dynamic tree which retireves all the nodes thorugh the database. Now on each node there is a + but if the node has no other subnodes it still has a
    Message 1 of 6 , Jul 23, 2007
    • 0 Attachment
      Ok i have a dynamic tree which retireves all the nodes thorugh the
      database. Now on each node there is a + but if the node has no other
      subnodes it still has a + sign indicating that there will be more
      nodes to show up if you click on it.

      Is there a solution to disable the "+" or no "+" at all.

      http://developer.yahoo.com/yui/examples/treeview/dynamic.html?mode=dist

      This example doesn't show at all!
    • Eric Miraglia
      Jerry, A node whose children are dynamically loaded is considered expandable until the user tries to expand it once and the dynamic load function returns
      Message 2 of 6 , Jul 24, 2007
      • 0 Attachment
        Jerry,

        A node whose children are dynamically loaded is considered "expandable" until the user tries to expand it once and the dynamic load function returns zero results -- then TreeView knows that there are no children and so can display its node icon in such a way that it is visibly a childless node.  To avoid this behavior, you could set the dynamic load property of each node individually and not set it for nodes that you know have no children.

        Note that in the example you cite below there is a radio button toggle for switching between the two modes for viewing node icons for childless nodes.

        Regards,
        Eric



        ______________________________________________
        Eric Miraglia
        Yahoo! User Interface Library



        On Jul 23, 2007, at 12:43 PM, jerry_gagliano wrote:

        Ok i have a dynamic tree which retireves all the nodes thorugh the
        database. Now on each node there is a + but if the node has no other
        subnodes it still has a + sign indicating that there will be more
        nodes to show up if you click on it.

        Is there a solution to disable the "+" or no "+" at all.

        http://developer.yahoo.com/yui/examples/treeview/dynamic.html?mode=dist

        This example doesn't show at all!


      • jerry_gagliano
        Hi Eric, Ok thanks But how do I set the dynamic load property of each node individually and not set it for nodes that I know have no children. This is what I
        Message 3 of 6 , Jul 24, 2007
        • 0 Attachment
          Hi Eric,

          Ok thanks

          But how do I set the dynamic load property of each node individually
          and not set it for nodes that I know have no children.

          This is what I did...

          tree.setDynamicLoad(loadNodeData,1);

          I passed an argument 1 but when the nodes loads up all "+" icons show
          and when i click on it then no icon is shown which is want. But I want
          no icons to show when the child nodes are loaded dynamically.


          Thanks



          --- In ydn-javascript@yahoogroups.com, Eric Miraglia <miraglia@...> wrote:
          >
          > Jerry,
          >
          > A node whose children are dynamically loaded is considered
          > "expandable" until the user tries to expand it once and the dynamic
          > load function returns zero results -- then TreeView knows that there
          > are no children and so can display its node icon in such a way that
          > it is visibly a childless node. To avoid this behavior, you could
          > set the dynamic load property of each node individually and not set
          > it for nodes that you know have no children.
          >
          > Note that in the example you cite below there is a radio button
          > toggle for switching between the two modes for viewing node icons for
          > childless nodes.
          >
          > Regards,
          > Eric
          >
          >
          >
          > ______________________________________________
          > Eric Miraglia
          > Yahoo! User Interface Library
          >
          >
          >
          > On Jul 23, 2007, at 12:43 PM, jerry_gagliano wrote:
          >
          > > Ok i have a dynamic tree which retireves all the nodes thorugh the
          > > database. Now on each node there is a + but if the node has no other
          > > subnodes it still has a + sign indicating that there will be more
          > > nodes to show up if you click on it.
          > >
          > > Is there a solution to disable the "+" or no "+" at all.
          > >
          > > http://developer.yahoo.com/yui/examples/treeview/dynamic.html?
          > > mode=dist
          > >
          > > This example doesn't show at all!
          > >
          > >
          > >
          >
        • Eric Miraglia
          Jerry, Per the documentation, dynamic loading can be defined for the entire tree or for individual nodes. setDynamicLoad is a method you can call on the
          Message 4 of 6 , Jul 24, 2007
          • 0 Attachment
            Jerry,

            Per the documentation, "dynamic loading can be defined for the entire tree or for individual nodes."  setDynamicLoad is a method you can call on the TreeView instance or on any node instance.

            Instead of setting the whole tree to load dynamically, you can set each node to do so; for nodes that have no children, you can simply avoid setting them to load dynamically.  If you do that, they won't have an expand icon.  As you loop through and create nodes, you'll have to know whether they have children.

            Regards,
            Eric

            ______________________________________________
            Eric Miraglia
            Yahoo! User Interface Library



            On Jul 24, 2007, at 8:12 AM, jerry_gagliano wrote:

            Hi Eric,

            Ok thanks

            But how do I set the dynamic load property of each node individually
            and not set it for nodes that I know have no children.

            This is what I did...

            tree.setDynamicLoad(loadNodeData,1);

            I passed an argument 1 but when the nodes loads up all "+" icons show
            and when i click on it then no icon is shown which is want. But I want
            no icons to show when the child nodes are loaded dynamically.

            Thanks

            --- In ydn-javascript@yahoogroups.com, Eric Miraglia <miraglia@...> wrote:
            >
            > Jerry,
            >
            > A node whose children are dynamically loaded is considered
            > "expandable" until the user tries to expand it once and the dynamic
            > load function returns zero results -- then TreeView knows that there
            > are no children and so can display its node icon in such a way that
            > it is visibly a childless node. To avoid this behavior, you could
            > set the dynamic load property of each node individually and not set
            > it for nodes that you know have no children.
            >
            > Note that in the example you cite below there is a radio button
            > toggle for switching between the two modes for viewing node icons for
            > childless nodes.
            >
            > Regards,
            > Eric
            >
            >
            >
            > ______________________________________________
            > Eric Miraglia
            > Yahoo! User Interface Library
            >
            >
            >
            > On Jul 23, 2007, at 12:43 PM, jerry_gagliano wrote:
            >
            > > Ok i have a dynamic tree which retireves all the nodes thorugh the
            > > database. Now on each node there is a + but if the node has no other
            > > subnodes it still has a + sign indicating that there will be more
            > > nodes to show up if you click on it.
            > >
            > > Is there a solution to disable the "+" or no "+" at all.
            > >
            > > http://developer.yahoo.com/yui/examples/treeview/dynamic.html?
            > > mode=dist
            > >
            > > This example doesn't show at all!
            > >
            > >
            > >
            >


          • Eric Miraglia
            Jerry, Sorry for the bad URL. Here is the correct one: http://developer.yahoo.com/yui/docs/ YAHOO.widget.Node.html#setDynamicLoad Regards, Eric
            Message 5 of 6 , Jul 24, 2007
            • 0 Attachment
              Jerry,

              Sorry for the bad URL.  Here is the correct one:

              http://developer.yahoo.com/yui/docs/YAHOO.widget.Node.html#setDynamicLoad

              Regards,
              Eric


              ______________________________________________
              Eric Miraglia
              Yahoo! User Interface Library





              On Jul 24, 2007, at 8:38 AM, Eric Miraglia wrote:

              Jerry,


              Per the documentation, "dynamic loading can be defined for the entire tree or for individual nodes."  setDynamicLoad is a method you can call on the TreeView instance or on any node instance.

              Instead of setting the whole tree to load dynamically, you can set each node to do so; for nodes that have no children, you can simply avoid setting them to load dynamically.  If you do that, they won't have an expand icon.  As you loop through and create nodes, you'll have to know whether they have children.

              Regards,
              Eric

              ______________________________________________
              Eric Miraglia
              Yahoo! User Interface Library



              On Jul 24, 2007, at 8:12 AM, jerry_gagliano wrote:

              Hi Eric,

              Ok thanks

              But how do I set the dynamic load property of each node individually
              and not set it for nodes that I know have no children.

              This is what I did...

              tree.setDynamicLoad(loadNodeData,1);

              I passed an argument 1 but when the nodes loads up all "+" icons show
              and when i click on it then no icon is shown which is want. But I want
              no icons to show when the child nodes are loaded dynamically.

              Thanks

              --- In ydn-javascript@yahoogroups.com, Eric Miraglia <miraglia@...> wrote:
              >
              > Jerry,
              >
              > A node whose children are dynamically loaded is considered
              > "expandable" until the user tries to expand it once and the dynamic
              > load function returns zero results -- then TreeView knows that there
              > are no children and so can display its node icon in such a way that
              > it is visibly a childless node. To avoid this behavior, you could
              > set the dynamic load property of each node individually and not set
              > it for nodes that you know have no children.
              >
              > Note that in the example you cite below there is a radio button
              > toggle for switching between the two modes for viewing node icons for
              > childless nodes.
              >
              > Regards,
              > Eric
              >
              >
              >
              > ______________________________________________
              > Eric Miraglia
              > Yahoo! User Interface Library
              >
              >
              >
              > On Jul 23, 2007, at 12:43 PM, jerry_gagliano wrote:
              >
              > > Ok i have a dynamic tree which retireves all the nodes thorugh the
              > > database. Now on each node there is a + but if the node has no other
              > > subnodes it still has a + sign indicating that there will be more
              > > nodes to show up if you click on it.
              > >
              > > Is there a solution to disable the "+" or no "+" at all.
              > >
              > > http://developer.yahoo.com/yui/examples/treeview/dynamic.html?
              > > mode=dist
              > >
              > > This example doesn't show at all!
              > >
              > >
              > >
              >




            • info2hussain
              Hi All, I want to create a dynamic tree with XHR data. I followed the YUI s example about that but I see nothing in the browser. I don t even get any error
              Message 6 of 6 , Jul 31, 2008
              • 0 Attachment
                Hi All,

                I want to create a dynamic tree with XHR data. I followed the YUI's example about that but I see nothing in the browser. I don't even get any error message. My codes are:

                <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
                <html>
                    <head>
                        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
                        <title>Untitled Document</title>
                        <!-- css -->
                        <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.2/build/treeview/assets/skins/sam/treeview.css">
                       
                        <script type="text/javascript" src="http://yui.yahooapis.com/2.5.1/build/yahoo/yahoo-min.js"></script>
                        <script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/event/event-min.js"></script>
                        <script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/connection/connection-min.js"></script>
                        <script type="text/javascript" src="http://yui.yahooapis.com/2.5.1/build/json/json-min.js"></script>
                        <script src = "http://yui.yahooapis.com/2.5.2/build/treeview/treeview-min.js" ></script>
                        <script type="text/javascript">
                           
                            function buildTree(){
                               
                                //create a new tree:
                                tree = new YAHOO.widget.TreeView("tree");
                               
                                //turn dynamic loading on for entire tree:
                                tree.setDynamicLoad(loadNodeData, currentIconMode);
                               
                                //get root node for tree:
                                var root = tree.getRoot();
                               
                                //add child nodes for tree;
                                var aStates = ["Process", "Activity", "Process Instance", "Activity Instance"];
                                for (var i = 0, j = aStates.length; i < j; i++) {
                                    var tempNode = new YAHOO.widget.TextNode(aStates[i], root, false);
                                }
                               
                               
                                tree.draw();
                               
                            }   
                                function loadNodeData(node, fnLoadComplete){
                               
                               
                                    var callbacks = {
                                        // Successful XHR response handler
                                        success: function(o){
                                            var messages = [];
                                           
                                            // Use the JSON Utility to parse the data returned from the server
                                            try {
                                                messages = YAHOO.lang.JSON.parse(o.responseText);
                                            }
                                            catch (x) {
                                                alert("JSON Parse failed!");
                                                return;
                                            }
                                           
                                            var len = messages.length;
                                            for (var i = 0; i < len; ++i) {
                                           
                                                var m = messages[i];
                                                var tempNode = new YAHOO.widget.TextNode(m.result[0].value, node, false);
                                               
                                            }
                                            o.argument.fnLoadComplete();
                                        },
                                       
                                        // Failed XHR response handler
                                        failure: function(o) {
                                       
                                            document.writeln("XHR Transaction failed!");
                                        },
                                   
                                       
                                        argument: {
                                            "node": node,
                                            "fnLoadComplete": fnLoadComplete
                                        },
                                   
                                   
                                        timeout: 7000
                                       
                                       
                                    };
                                   
                                   
                                    url = "/api-rest/query?f=json&o=execution-history&q=" + escape("(setofall ?x (instance-of ?x #_COBRA:ActivityInstance))");
                                   
                                    // Make the call to the server for JSON data
                                    YAHOO.util.Connect.asyncRequest('GET', url, callbacks);
                                   
                                }
                           
                        </script>
                    </head>
                    <body class="yui-skin-sam" onload="buildTree()">
                        <div id="tree"></div>
                       
                    </body>
                </html>


                I marked something red in my code as I think many of you might think there is something wrong with that specific part. But, I can assure you that this red marked part is completely ok and I tested it. When I tried the XHR part of my code separately, it worked fine and I can access the data and show them in the browser properly but problem comes when I try to use the same code in with the treeview thing.


                Any one has any idea or any suggestion?

                Thanks,
                H
              Your message has been successfully submitted and would be delivered to recipients shortly.