• 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.09.05-20-01

    Return to ContextMenu View

    YUI({
        //Last Gallery Build of this module
        gallery: 'gallery-2013.01.23-21-59'
    }).use('datatable', 'gallery-contextmenu-view', function(Y) {
    //
    //  Define a simple DataTable ...
    //
       var dt = new Y.DataTable({
           data:  [ .... ],
           columns: [ ....]
       });
     
    //
    //  Create the ContextMenuView 
    //    - in a new container 
    //    - with nested DIV's as the menu item template
    //    - define the menu items
    //    - configure the menu to fire on the DataTable's <table>, 
    //         with specific "target" as the TR node 
    //
       var cmenu = new Y.ContextMenuView({
        container: Y.Node.create('<div id="cmenuView" class="cmenu"></div>'),
        menuItemTemplate: '<div class="yui3-contextmenu-menuitem" data-cmenu="{menuIndex}">{menuContent}</div>',
        menuItems: [
           {label:"Edit", value:"e"},
           {label:"Update", value:"u"},
           {label:"Insert Before", value:"i"},
           {label:"Insert After", value:"a"},
           {label:"<hr/>", value:null},
           {label:"Delete Record", value:"d"},
           {label:"Destroy Cmenu", value:"dc"}
        ],
        trigger: {
           node:    dt.get('srcNode').one('table .yui3-datatable-data'),
           target:  'tr'
        }
      });
     
    //
    //  Set a listener on the ContextMenuView's "selectedMenu" attribute when it changes ...
    //
       cmenu.after('selectedMenuChange',  function(e) {
           var tr = this.get('contextTarget'),
               mindx = +(e.newVal.menuIndex);
     
           Y.log("For targeted TR of;");
           Y.log(tr);
     
           Y.log("Selected menu choice was menu index " + mindx);
           Y.log("with menu object as;");
           Y.log(e.newVal.menuItem);
        });
     
     
    });

    Build Output

    /home/y/libexec/ant/bin/ant all
    Buildfile: build.xml
         [echo] Starting Build For gallery-contextmenu-view
    
    clean:
    
    init:
        [mkdir] Created dir: /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-contextmenu-view/build_tmp
         [echo] Starting Build For gallery-contextmenu-view
    
    -lint-server:
         [echo] Starting Build For gallery-contextmenu-view
    
    -node:
         [echo] For faster builds, install Node.js.
    
    -concatdebug:
         [copy] Copying 1 file to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-contextmenu-view/build_tmp/ant
       [delete] Deleting directory /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-contextmenu-view/build_tmp/ant
    
    -registerdebug:
         [copy] Copying 1 file to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-contextmenu-view/build_tmp
    
    -prependdebug:
    
    -appenddebug:
    
    builddebug:
    
    -createcore:
         [copy] Copying 1 file to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-contextmenu-view/build_tmp
    
    -loggerregex:
    
    buildcore:
    
    -rollupjs:
    
    -concatskins:
         [copy] Copying 2 files to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-contextmenu-view/build_tmp/ant
       [delete] Deleting directory /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-contextmenu-view/build_tmp/ant
    [yuicompressor] Compressing /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-contextmenu-view/build_tmp/assets/skins/sam/gallery-contextmenu-view.css
    [yuicompressor] Compressed to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-contextmenu-view/build_tmp/assets/skins/sam/gallery-contextmenu-view.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-contextmenu-view/build_tmp/gallery-contextmenu-view.js
         [move] Moving 1 file to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-contextmenu-view/build_tmp
         [move] Moving 1 file to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-contextmenu-view/build_tmp
    
    minify:
    [yuicompressor] Compressing /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-contextmenu-view/build_tmp/gallery-contextmenu-view.js
    [yuicompressor] 
    [yuicompressor] [WARNING] Try to use a single 'var' statement per scope.
    [yuicompressor] false;}cont.empty(); ---> var  <--- overlay=new Y.Overlay({srcNode:
    [yuicompressor] 
    [yuicompressor] [WARNING] Try to use a single 'var' statement per scope.
    [yuicompressor] :99,constrain:true}); ---> var  <--- bodyHTML="";Y.Array.each(
    [yuicompressor] Compressed to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/src/gallery-contextmenu-view/build_tmp/gallery-contextmenu-view-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-contextmenu-view/build_tmp/gallery-contextmenu-view.js
         [java]  
         [java] 
         [java] 	62, 44: ['node'] is better written in dot notation.
         [java] 	var triggerC = this.get('trigger')['node'],
         [java] 
         [java] 	63, 44: ['target'] is better written in dot notation.
         [java] 	triggerT = this.get('trigger')['target'];
         [java] 
         [java] 	93, 13: Expected '{' and instead saw 'this'.
         [java] 	this.get('overlay').destroy();
         [java] 
         [java] 	114, 34: Expected '{' and instead saw 'return'.
         [java] 	if(!this.get('overlay')) return;
         [java] 
         [java] 	132, 19: Expected '{' and instead saw 'return'.
         [java] 	if(!cont) return false;
         [java] 
         [java] 	198, 13: Expected '{' and instead saw 'this'.
         [java] 	this.set('selectedMenu', {
         [java] 
         [java] 	215, 33: Expected '{' and instead saw 'sel'.
         [java] 	if ( sel && sel.empty ) sel.empty();    // works on chrome
         [java] 
         [java] 	216, 43: Expected '{' and instead saw 'sel'.
         [java] 	if ( sel && sel.removeAllRanges ) sel.removeAllRanges();    // works on FireFox
         [java] 
         [java]  
         [java] 
    
    local:
    
    deploybuild:
         [copy] Copying 4 files to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/build/gallery-contextmenu-view
    
    deployassets:
         [copy] Copying 1 file to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/build/gallery-contextmenu-view/assets
    
    deployskins:
         [copy] Copying 1 file to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/build/gallery-contextmenu-view/assets/skins/sam
         [copy] Copying 1 file to /home/y/var/builds/workspace/gallery/build_tmp/src/yui3-gallery/build/gallery-contextmenu-view/assets/skins/sam
    
    deploylang:
    
    deploydocs:
    
    deploy:
    
    all:
    
    BUILD SUCCESSFUL
    Total time: 3 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