-
-
Save teaualune/6062663 to your computer and use it in GitHub Desktop.
Revisions
-
teaualune revised this gist
Jul 23, 2013 . 1 changed file with 9 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -52,7 +52,6 @@ <h1><a href="https://www.facebook.com/bjeremyl">T.T FB</a> ~~~~~~</h1> {id: 'n1', name: "Brian", years: 23, price: "$16.88 (On-Sale)"}, {id: 'n2', name: "Emily", years: 24, price: "$29.99"}, {id: 'n3', name: "TaiYen", years: "forever 19", price: "Priceless"}, ], // A table from data with keys that work fine as column names simple = new Y.DataTable({ @@ -62,7 +61,13 @@ <h1><a href="https://www.facebook.com/bjeremyl">T.T FB</a> ~~~~~~</h1> data: data, summary: "Price sheet for inventory parts QQ", caption: "Example table with simple columns" }), dataObject = { "Brian": "$16.88 (On-Sale)", "Emily": "$29.99", "TaiYen": "Priceless" }; Y.on("click", function (e) { simple.render("#simple"); @@ -74,17 +79,8 @@ <h1><a href="https://www.facebook.com/bjeremyl">T.T FB</a> ~~~~~~</h1> }, '#button2') ; Y.on("click", function (e) { var searchText = Y.one('input').get('value'); alert(dataObject[searchText] ? dataObject[searchText] : 'Are you kidding?'); }, '#button3'); }); -
teaualune renamed this gist
Jul 23, 2013 . 1 changed file with 18 additions and 37 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -52,9 +52,9 @@ <h1><a href="https://www.facebook.com/bjeremyl">T.T FB</a> ~~~~~~</h1> {id: 'n1', name: "Brian", years: 23, price: "$16.88 (On-Sale)"}, {id: 'n2', name: "Emily", years: 24, price: "$29.99"}, {id: 'n3', name: "TaiYen", years: "forever 19", price: "Priceless"}, {id: 'n4', name: "TaiYen", years: "forever 18", price: "Great worth"} ], // A table from data with keys that work fine as column names simple = new Y.DataTable({ //可以不要 columns: ["name", "years", "price"], @@ -72,41 +72,22 @@ <h1><a href="https://www.facebook.com/bjeremyl">T.T FB</a> ~~~~~~</h1> Y.on("click", function (e) { Y.one("#simple").hide(); }, '#button2') ; Y.on("click", function (e) { var nameString = '', searchText = Y.one('input').get('value'), i = 0, matched = false; for (i; i < data.length; i = i + 1) { if (searchText === data[i].name) { nameString = nameString + data[i].price + ', '; matched = true; } } alert(matched ? nameString : 'Are you kidding?'); }, '#button3'); }); </script> </body> </html> -
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,112 @@ <html> <head> <title>T.T. in GT Lab</title> <meta http-equiv=content-type content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.10.2/build/cssreset/cssreset-min.css"> <style type="text/css"> #query { margin: 10px 0; } #controls { margin: 10px 0; } .rpp { padding-left: 1.5em; } .yui3-skin-sam .yui3-datatable caption { padding: 0 !important; } .yui3-skin-sam .yui3-paginator-rpp-options { margin-left: 0; } </style> </head> <body class="yui3-skin-sam"> Good morning Georgia! <h1><a href="https://www.facebook.com/bjeremyl">T.T FB</a> ~~~~~~</h1> <hr> <form id="query-form" name="query_form"> <div id="query"></div> </form> <div> <div id="simple"></div> <button id="button1">I Love</button> <button id="button2">YuZu</button> <button id="button3">(~"~)</button> </div> <input type="text" placeholder="search name..." /> <script src="http://yui.yahooapis.com/3.10.2/build/yui/yui-min.js"></script> <script> YUI({ gallery: 'gallery-2013.06.26-23-09' }).use( 'datatable-datasource', 'datasource-arrayschema', 'gallery-querybuilder', 'gallery-formmgr', 'gallery-paginator', 'array-extras', function (Y) { var data = [ {id: 'n1', name: "Brian", years: 23, price: "$16.88 (On-Sale)"}, {id: 'n2', name: "Emily", years: 24, price: "$29.99"}, {id: 'n3', name: "TaiYen", years: "forever 19", price: "Priceless"}, {id: 'n4', name: "TaiYen", years: "forever 18", price: "Great worth"} ]; // A table from data with keys that work fine as column names simple = new Y.DataTable({ //可以不要 columns: ["name", "years", "price"], //data:不可改成→data= data: data, summary: "Price sheet for inventory parts QQ", caption: "Example table with simple columns" }); Y.on("click", function (e) { simple.render("#simple"); Y.one("#simple").show(); }, '#button1'); Y.on("click", function (e) { Y.one("#simple").hide(); }, '#button2') ; // var searchText = Y.one('input').get('value'), i = 0, nameString={}, matched = false; buttonshow; for (i; i < data.length; i = i + 1) { nameString[data[i].name]=data[i].price; if (searchText === data[i].name) { nameString[data[i].name]=data[i].price; matched = true; buttonshow = nameString[data[i].name]; } } if (!matched) { buttonshow = "Are you kidding!?"; }; var functionbutton3 = function (e){alert(buttonshow); if (searchText === data[i].name) { nameString[data[i].name]=data[i].price; matched = true; buttonshow = nameString[data[i].name]; } if (!matched) { buttonshow = "Are you kidding!?"; }; }; Y.on("click", function (e){functionbutton3(e)}, '#button3'); }); </script> </body> </html>