• Register
  • Log In
  • Home
  • Quick Start
    • Configurator
    • Download YUI 3
  • Documentation
    • User Guides
    • Examples
    • API Docs
    • Environments
    • Tutorials
  • Community
    • Gallery
    • Blog
    • Forums
    • YUI Theater
    • Calendar
  • Contribute
    • YUI on GitHub »
    • File a Ticket
    • View Tickets
    • Dashboard
  • Other Projects
    • Shifter »
    • Yogi »
    • YUI 2
    • YUI Doc »
    • YUI Test
    • YUI Website
    • YUI Compressor »
    • YUI Builder »
    • YUI PHP Loader
    • Grid Builder »
    • Skin Builder »
  • YUI
  • >
  • Community
  • >
  • Gallery

Gallery

Modules

  • Home
  • Featured
  • Popular
  • New
  • All

Documentation

  • Yogi Documentation
  • Shifter Documentation
  • Developer Guide
  • Module Setup

Tag Cloud

Context Navigation

    Build Tag: gallery-2012.08.29-20-10

    Return to TreeView

    <div id="#cattree1"></div>
    <div id="#report1"></div>
    <div id="#report2"></div>
    <script>
    YUI({
        //Last Gallery Build of this module
        gallery: 'gallery-2012.08.29-20-10'
    }).use("gallery-yui3treeview-ng", function(Y) {
        var treeview = new Y.CheckBoxTreeView({
                startCollapsed: true,
                toggleOnLabelClick: false,
                children: [ {
                    label: "Root",
                    checked: "halfchecked",
                    children: [ 
                        {
                            label : "sub 1",
                            checked: "checked",
                            children : [
                                { label: "sub 1-1"},
                                { label: "sub 1-2"},
                            ]
                        },
                        {
                            label : "sub 2",
                            children : [
                                { label: "sub 2-1"},
                                {
                                    label: "sub 2-2",
                                    children: [
                                        { label: "sub 2-2-1" },
                                        { label: "sub 2-2-2" }
                                    ]
                                },
                            ]
                        }
                    ]
                }]
        });
        treeview.render("#cattree1");
     
        var r1 = Y.one("#report1"),
            r2 = Y.one("#report2");
     
        treeview.on("nodeclick", function(e) {
            var node = e.treenode;
            r1.setContent("");
            r1.appendChild("<li>You clicked " + (node.get("isLeaf") ? "leaf" : "node") + ": " + node.get("label"));
            r1.appendChild("<li>Path to root is: " + node.path().join(" > "));
            r1.appendChild("<li>State is: " + (node.get("collapsed") ? "collapsed" : "expanded") );
        });
     
        treeview.after("check", function(e) {
            var node = e.treenode,
                checked_roots = "",
                checked_paths = "";
     
            r2.setContent("");
            r2.appendChild("<li>CheckBox State is: " + {10:"unchecked", 20:"halfchecked", 30:"checked"}[node.get("checked")]);
     
            Y.Array.each(treeview.getChecked(), function (n) {
                checked_roots += "<li> " + n.get("label");
            });
            r2.appendChild("<li>Checked subroots are: <ul>" + checked_roots + "</ul>")
     
            Y.Array.each(treeview.getCheckedPaths(), function (n) {
                checked_paths += "<li> " + n.join(" > ");
            });
            r2.appendChild("<li>Pathes to checked subroots are: <ul>" + checked_paths + "</ul>")
        });
    </script>

    Build Output

    /home/y/libexec/ant/bin/ant all
    Buildfile: build.xml
         [echo] Starting Build For gallery-yui3treeview-ng
    
    clean:
    
    init:
        [mkdir] Created dir: /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-yui3treeview-ng/build_tmp
         [echo] Starting Build For gallery-yui3treeview-ng
    
    -lint-server:
         [echo] Starting Build For gallery-yui3treeview-ng
    
    -node:
         [echo] For faster builds, install Node.js.
    
    -concatdebug:
         [copy] Copying 2 files to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-yui3treeview-ng/build_tmp/ant
       [delete] Deleting directory /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-yui3treeview-ng/build_tmp/ant
    
    -registerdebug:
         [copy] Copying 1 file to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-yui3treeview-ng/build_tmp
    
    -prependdebug:
    
    -appenddebug:
    
    builddebug:
    
    -createcore:
         [copy] Copying 1 file to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-yui3treeview-ng/build_tmp
    
    -loggerregex:
    
    buildcore:
    
    -rollupjs:
    
    -concatskins:
         [copy] Copying 2 files to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-yui3treeview-ng/build_tmp/ant
       [delete] Deleting directory /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-yui3treeview-ng/build_tmp/ant
    [yuicompressor] Compressing /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-yui3treeview-ng/build_tmp/assets/skins/sam/gallery-yui3treeview-ng.css
    [yuicompressor] Compressed to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-yui3treeview-ng/build_tmp/assets/skins/sam/gallery-yui3treeview-ng.css
    
    -buildskins:
    
    -rollupcss:
    
    buildskins:
    
    -buildlangs:
    
    -rolluplangs:
    
    buildlangs:
    
    build:
    
    build-coverage:
         [echo] Creating coverage file for: /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-yui3treeview-ng/build_tmp/gallery-yui3treeview-ng.js
         [move] Moving 1 file to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-yui3treeview-ng/build_tmp
         [move] Moving 1 file to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-yui3treeview-ng/build_tmp
    
    minify:
    [yuicompressor] Compressing /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-yui3treeview-ng/build_tmp/gallery-yui3treeview-ng.js
    [yuicompressor] Compressed to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-yui3treeview-ng/build_tmp/gallery-yui3treeview-ng-min.js
    
    lint:
         [echo] Using Rhino. Install nodejs to improve jslint speed, or skip with -Dlint.skip=true
         [java] Running JSLint on : /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-yui3treeview-ng/build_tmp/gallery-yui3treeview-ng.js
         [java] - OK
    
    local:
    
    deploybuild:
         [copy] Copying 4 files to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/build/gallery-yui3treeview-ng
    
    deployassets:
         [copy] Copying 1 file to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/build/gallery-yui3treeview-ng/assets
    
    deployskins:
         [copy] Copying 1 file to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/build/gallery-yui3treeview-ng/assets/skins/sam
         [copy] Copying 5 files to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/build/gallery-yui3treeview-ng/assets/skins/sam
    
    deploylang:
    
    deploydocs:
    
    deploy:
    
    all:
    
    BUILD SUCCESSFUL
    Total time: 4 seconds

    © 2006-2013 Yahoo! Inc. All rights reserved.
    All code on this site is licensed under the BSD License unless stated otherwise.
    About This Site · Security Contact Info