The Gallery is deprecated. No new Gallery components may be submitted, and modifying existing components is disabled. For more information please read the Gallery Deprecation blog post. This is a static snapshot of the Gallery for archive purposes.
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);
});
});
---------- start logs from yogi.stdout.log ---------- yogi [info] using yogi@0.0.66 on node@0.8.18 yogi [info] using module: gallery-contextmenu-view yogi [info] running with shifter shifter [info] racing to find the closest .shifter.json file shifter [info] revving up shifter [info] looking for build.json file shifter [info] found build.json file, shifting shifter [info] putting the hammer down, let's build this thing! shifter [info] munging in loader meta data into build.json shifter [info] putting the hammer down shifter [info] shifting into gear for gallery-contextmenu-view shifter [queu] file has changed, continuing build shifter [queu] writing RAW file shifter [queu] compressing gallery-contextmenu-view/gallery-contextmenu-view.js with UglifyJS shifter [queu] writing -min file shifter [info] shifting for coverage shifter [info] shifting skin for gallery-contextmenu-view shifter [queu] coverage file read, starting coverage for: gallery-contextmenu-view/gallery-contextmenu-view.js shifter [info] istanbul providing coverage shifter [queu] instrumenting with istanbul shifter [queu] writing coverage file to gallery-contextmenu-view/gallery-contextmenu-view-coverage.js shifter [queu] copying assets to skin for sam shifter [info] css lint passed for /assets/skins/sam/gallery-contextmenu-view-skin.css shifter [queu] writing skin file with core wrapper shifter [queu] writing skin file without core wrapper shifter [info] done racing, the gears are toast shifter [info] finished in 0.197 seconds, pretty fast huh? yogi [info] build complete yogi [info] testing module now yogi [info] prepping grover tests yogi [info] adding tests route yogi [info] turning on coverage support in grover yogi [info] launching xdr server on port 5001 yogi [info] listening on: http://127.0.0.1:5000 Starting Grover on 1 files with PhantomJS@1.8.0 Running 15 concurrent tests at a time. Using a 120 second timeout per test. ✔ [gallery-contextmenu-view]: Passed: 5 Failed: 0 Total: 5 (ignored 0) (0.627 seconds) 93% Writing files in JSON format to: /src/gallery-contextmenu-view/logs/tests.json ┌─────────────────────────────────────────────────────────────────┬─────────┬───────┬─────────────┬───────┐ │[34m path │[34m lines │[34m % │[34m functions │[34m % │ ├─────────────────────────────────────────────────────────────────┼─────────┼───────┼─────────────┼───────┤ │ ✔ /build/gallery-contextmenu-view/gallery-contextmenu-view.js │ 46/49 │ 93% │ 12/13 │ 92% │ ├─────────────────────────────────────────────────────────────────┼─────────┼───────┼─────────────┼───────┤ │ total │ 46/49 │ 93% │ 12/13 │ 92% │ └─────────────────────────────────────────────────────────────────┴─────────┴───────┴─────────────┴───────┘ ---------------------------------------------------------------- ✔ [Total]: Passed: 5 Failed: 0 Total: 5 (ignored 0) (0.627 seconds) [Grover Execution Timer] 1.811 seconds Failed to find source file: /build/gallery-contextmenu-view/gallery-contextmenu-view.js yogi [bail] grover returned a failure ---------- end logs from yogi.stdout.log ---------- ---------- start logs from yogi.stderr.log ---------- no data logged ---------- end logs from yogi.stderr.log ----------
All code on this site is licensed under the BSD License unless stated otherwise.