upgrading to YUI 2.6
data tables are going to need some work yet, but the other stuff seems to be working 100%
This commit is contained in:
parent
a041e93da8
commit
20f8df1291
2106 changed files with 993560 additions and 237 deletions
1
www/extras/yui/examples/datatable/assets/html/blank.html
Normal file
1
www/extras/yui/examples/datatable/assets/html/blank.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<html><body></body></html>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 53 KiB |
BIN
www/extras/yui/examples/datatable/assets/img/bl.gif
Normal file
BIN
www/extras/yui/examples/datatable/assets/img/bl.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 94 B |
BIN
www/extras/yui/examples/datatable/assets/img/br.gif
Normal file
BIN
www/extras/yui/examples/datatable/assets/img/br.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 94 B |
BIN
www/extras/yui/examples/datatable/assets/img/tl.gif
Normal file
BIN
www/extras/yui/examples/datatable/assets/img/tl.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 94 B |
BIN
www/extras/yui/examples/datatable/assets/img/tr.gif
Normal file
BIN
www/extras/yui/examples/datatable/assets/img/tr.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 94 B |
490
www/extras/yui/examples/datatable/assets/js/data.js
vendored
Normal file
490
www/extras/yui/examples/datatable/assets/js/data.js
vendored
Normal file
|
|
@ -0,0 +1,490 @@
|
|||
YAHOO.example.Data = {
|
||||
apitester: [
|
||||
{number:0, date:new Date(1999, 1, 1), string:"1"},
|
||||
{number:1, date:new Date(1999, 10, 10), string:"12"},
|
||||
{number:2, date:new Date(2000, 1, 1), string:"123"},
|
||||
{number:3, date:new Date(2000, 10, 1), string:"10"},
|
||||
{number:4, date:new Date(2001, 10, 12), string:"1"},
|
||||
{number:5, date:new Date(2001, 1, 12), string:"123"},
|
||||
{number:6, date:new Date(2001, 10, 1), string:"11"},
|
||||
{number:7, date:new Date(2001, 10, 1), string:"16"},
|
||||
{number:8, date:new Date(2001, 10, 1), string:"8"},
|
||||
{number:9, date:new Date(2001, 10, 1), string:"6"},
|
||||
{number:10, date:new Date(2001, 10, 1), string:"66"},
|
||||
{number:11, date:new Date(2001, 10, 1), string:"111"},
|
||||
{number:12, date:new Date(2001, 10, 1), string:"110"}
|
||||
],
|
||||
|
||||
multitypes: {
|
||||
items: [
|
||||
{field1: "bananas", field2:new Date(2007, 1, 1), field3:111, field4:"23.4", field5:"bob", field6:"http://www.yahoo.com"},
|
||||
{field1: "cherries", field2:new Date(2006, 1, 1), field3:12.3, field4:"35.12", field5:"ann", field6:"http://www.yahoo.com"},
|
||||
{field1: "apples", field2:new Date(2007, 11, 1), field3:1, field4:34.12, field5:"charlie", field6:"http://www.yahoo.com"},
|
||||
{field1: "bananas", field2:new Date(2007, 1, 11), field3:1112, field4:"03", field5:"diane", field6:"http://www.yahoo.com"},
|
||||
{field1: "cherries", field2:new Date(1999, 1, 11), field3:124, field4:03, field5:"edgar", field6:"http://www.yahoo.com"},
|
||||
{field1: "bananas", field2:"January 10, 2005", field3:"12", field4:"34", field5:"francine", field6:"http://www.yahoo.com"},
|
||||
{field1: "apples", field2:"January 1, 2005", field3:"19.1", field4:"234.5", field5:"george", field6:"http://www.yahoo.com"},
|
||||
{field1: "bananas", field2:"1/11/05", field3:"10.02", field4:"345.654", field5:"hannah", field6:"http://www.yahoo.com"},
|
||||
{field1: "cherries", field2:"1/11/2005", field3:"109", field4:23.456, field5:"igor", field6:"http://www.yahoo.com"},
|
||||
{field1: "bananas", field2:"November 1, 2005", field3:"11111", field4:23.0123, field5:"julie", field6:"http://www.yahoo.com"}
|
||||
]
|
||||
},
|
||||
|
||||
webstats: [
|
||||
["home.html",20,400,44,657],
|
||||
["blog.html",24,377,97,567],
|
||||
["contact.html",32,548,42,543],
|
||||
["about.html",8,465,12,946],
|
||||
["pagenotfound.html",0,0,0,0]
|
||||
],
|
||||
|
||||
emails: {
|
||||
account:"jenny@yahoo.com",
|
||||
currStorage: 10,
|
||||
maxStorage: 200,
|
||||
messages: [
|
||||
{XID: "9897",Date:new Date(1981, 2, 24),To:"Joe",From:"Jenny",Unread:false,Subject:"Check out my new pictures"},
|
||||
{XID: "7899",Date:new Date(1980, 1, 11),To:"Jane",From:"Jenny",Unread:false,Subject:"Let's have lunch"},
|
||||
{XID: "6789",Date:new Date(1978, 11, 12),To:"Ann",From:"Jenny",Unread:false,Subject:"Here's the info you requested"},
|
||||
{XID: "4996",Date:new Date(1974, 1, 11),To:"Bob",From:"Jenny",Unread:true,Subject:"RE: Let's have lunch"},
|
||||
{XID: "4544",Date:new Date(1974, 1, 10),To:"Charlie",From:"Jenny",Unread:false,Subject:"Birthday party Saturday"}
|
||||
]
|
||||
},
|
||||
|
||||
inventory: [
|
||||
{SKU:"23-23874", Quantity:43, Item:"Helmet", Description:"Red baseball helmet. Size: Large."},
|
||||
{SKU:"48-38835", Quantity:84, Item:"Football", Description:"Leather football."},
|
||||
{SKU:"84-84848", Quantity:31, Item:"Goggles", Description:"Light blue swim goggles"},
|
||||
{SKU:"84-84843", Quantity:56, Item:"Badminton Set", Description:"Set of 2 badminton rackets, net, and 3 birdies."},
|
||||
{SKU:"84-39321", Quantity:128, Item:"Tennis Balls", Description:"Canister of 3 tennis balls."},
|
||||
{SKU:"39-48949", Quantity:55, Item:"Snowboard", Description:""},
|
||||
{SKU:"99-28128", Quantity:77, Item:"Cleats", Description:"Soccer cleats. Size: 10."},
|
||||
{SKU:"83-48281", Quantity:65, Item:"Volleyball", Description:""},
|
||||
{SKU:"89-32811", Quantity:12, Item:"Sweatband", Description:"Blue sweatband. Size: Medium."},
|
||||
{SKU:"28-22847", Quantity:43, Item:"Golf Set", Description:"Set of 9 golf clubs and bag."},
|
||||
{SKU:"38-38281", Quantity:1, Item:"Basketball Shorts", Description:"Green basketball shorts. Size: Small."},
|
||||
{SKU:"82-38333", Quantity:288, Item:"Lip balm", Description:"Lip balm. Flavor: Cherry."},
|
||||
{SKU:"21-38485", Quantity:177, Item:"Ping Pong Ball", Description:""},
|
||||
{SKU:"83-38285", Quantity:87, Item:"Hockey Puck", Description:"Glow-in-the-dark hockey puck."}
|
||||
],
|
||||
|
||||
addresses: [
|
||||
{name:"John A. Smith", address:"1236 Some Street", city:"San Francisco", state:"CA", amount:5, active:"yes", colors:["red"], last_login:"4/19/2007"},
|
||||
{name:"Joan B. Jones", address:"3271 Another Ave", city:"New York", state:"NY", amount:3, active:"no", colors:["red","blue"], last_login:"2/15/2006"},
|
||||
{name:"Bob C. Uncle", address:"9996 Random Road", city:"Los Angeles", state:"CA", amount:0, active:"maybe", colors:["green"], last_login:"1/23/2004"},
|
||||
{name:"John D. Smith", address:"1623 Some Street", city:"San Francisco", state:"CA", amount:5, active:"yes", colors:["red"], last_login:"4/19/2007"},
|
||||
{name:"Joan E. Jones", address:"3217 Another Ave", city:"New York", state:"NY", amount:3, active:"no", colors:["red","blue"], last_login:"2/15/2006"},
|
||||
{name:"Bob F. Uncle", address:"9899 Random Road", city:"Los Angeles", state:"CA", amount:0, active:"maybe", colors:["green"], last_login:"1/23/2004"},
|
||||
{name:"John G. Smith", address:"1723 Some Street", city:"San Francisco", state:"CA", amount:5, active:"yes", colors:["red"], last_login:"4/19/2007"},
|
||||
{name:"Joan H. Jones", address:"3241 Another Ave", city:"New York", state:"NY", amount:3, active:"no", colors:["red","blue"], last_login:"2/15/2006"},
|
||||
{name:"Bob I. Uncle", address:"9909 Random Road", city:"Los Angeles", state:"CA", amount:0, active:"maybe", colors:["green"], last_login:"1/23/2004"},
|
||||
{name:"John J. Smith", address:"1623 Some Street", city:"San Francisco", state:"CA", amount:5, active:"yes", colors:["red"], last_login:"4/19/2007"},
|
||||
{name:"Joan K. Jones", address:"3721 Another Ave", city:"New York", state:"NY", amount:3, active:"no", colors:["red","blue"], last_login:"2/15/2006"},
|
||||
{name:"Bob L. Uncle", address:"9989 Random Road", city:"Los Angeles", state:"CA", amount:0, active:"maybe", colors:["green"], last_login:"1/23/2004"},
|
||||
{name:"John M. Smith", address:"1293 Some Street", city:"San Francisco", state:"CA", amount:5, active:"yes", colors:["red"], last_login:"4/19/2007"},
|
||||
{name:"Joan N. Jones", address:"3621 Another Ave", city:"New York", state:"NY", amount:3, active:"no", colors:["red","blue"], last_login:"2/15/2006"},
|
||||
{name:"Bob O. Uncle", address:"9959 Random Road", city:"Los Angeles", state:"CA", amount:0, active:"maybe", colors:["green"], last_login:"1/23/2004"},
|
||||
{name:"John P. Smith", address:"6123 Some Street", city:"San Francisco", state:"CA", amount:5, active:"yes", colors:["red"], last_login:"4/19/2007"},
|
||||
{name:"Joan Q. Jones", address:"3281 Another Ave", city:"New York", state:"NY", amount:3, active:"no", colors:["red","blue"], last_login:"2/15/2006"},
|
||||
{name:"Bob R. Uncle", address:"9989 Random Road", city:"Los Angeles", state:"CA", amount:0, active:"maybe", colors:["green"], last_login:"1/23/2004"}
|
||||
],
|
||||
|
||||
bookorders: [
|
||||
{id:"po-0167", date:new Date(1980, 2, 24), quantity:1, amount:4, title:"A Book About Nothing"},
|
||||
{id:"po-0783", date:new Date("January 3, 1983"), quantity:null, amount:12.12345, title:"The Meaning of Life"},
|
||||
{id:"po-0297", date:new Date(1978, 11, 12), quantity:12, amount:1.25, title:"This Book Was Meant to Be Read Aloud"},
|
||||
{id:"po-1482", date:new Date("March 11, 1985"), quantity:6, amount:3.5, title:"Read Me Twice"}
|
||||
],
|
||||
|
||||
stateAbbrs: [
|
||||
"AL","AK","AZ","AR","CA","CO","CT","DE","DC","FL","GA","HI",
|
||||
"ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS",
|
||||
"MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR",
|
||||
"PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY"
|
||||
],
|
||||
|
||||
areacodes: [
|
||||
{areacode: "201", state: "New Jersey"},
|
||||
{areacode: "202", state: "Washington, DC"},
|
||||
{areacode: "203", state: "Connecticut"},
|
||||
{areacode: "204", state: "Manitoba, Canada"},
|
||||
{areacode: "205", state: "Alabama"},
|
||||
{areacode: "206", state: "Washington"},
|
||||
{areacode: "207", state: "Maine"},
|
||||
|
||||
{areacode: "208", state: "Idaho"},
|
||||
{areacode: "209", state: "California"},
|
||||
{areacode: "210", state: "Texas"},
|
||||
{areacode: "212", state: "New York"},
|
||||
{areacode: "213", state: "California"},
|
||||
{areacode: "214", state: "Texas"},
|
||||
|
||||
{areacode: "215", state: "Pennsylvania"},
|
||||
{areacode: "216", state: "Ohio"},
|
||||
{areacode: "217", state: "Illinois"},
|
||||
{areacode: "218", state: "Minnesota"},
|
||||
{areacode: "219", state: "Indiana"},
|
||||
{areacode: "224", state: "Illinois"},
|
||||
|
||||
{areacode: "225", state: "Louisiana"},
|
||||
{areacode: "227", state: "Maryland"},
|
||||
{areacode: "228", state: "Mississippi"},
|
||||
{areacode: "229", state: "Georgia"},
|
||||
{areacode: "231", state: "Michigan"},
|
||||
{areacode: "234", state: "Ohio"},
|
||||
|
||||
{areacode: "239", state: "Florida"},
|
||||
{areacode: "240", state: "Maryland"},
|
||||
{areacode: "242", state: "Bahamas"},
|
||||
{areacode: "246", state: "Barbados"},
|
||||
{areacode: "248", state: "Michigan"},
|
||||
{areacode: "250", state: "British Columbia"},
|
||||
|
||||
{areacode: "251", state: "Alabama"},
|
||||
{areacode: "252", state: "North Carolina"},
|
||||
{areacode: "253", state: "Washington"},
|
||||
{areacode: "254", state: "Texas"},
|
||||
{areacode: "256", state: "Alabama"},
|
||||
{areacode: "260", state: "Indiana"},
|
||||
|
||||
{areacode: "262", state: "Wisconsin"},
|
||||
{areacode: "264", state: "Anguilla"},
|
||||
{areacode: "267", state: "Pennsylvania"},
|
||||
{areacode: "268", state: "Antigua and Barbuda"},
|
||||
{areacode: "269", state: "Michigan"},
|
||||
{areacode: "270", state: "Kentucky"},
|
||||
|
||||
{areacode: "276", state: "Virginia"},
|
||||
{areacode: "281", state: "Texas"},
|
||||
{areacode: "283", state: "Ohio"},
|
||||
{areacode: "284", state: "British Virgin Islands"},
|
||||
{areacode: "289", state: "Ontario"},
|
||||
{areacode: "301", state: "Maryland"},
|
||||
|
||||
{areacode: "302", state: "Delaware"},
|
||||
{areacode: "303", state: "Colorado"},
|
||||
{areacode: "304", state: "West Virginia"},
|
||||
{areacode: "305", state: "Florida"},
|
||||
{areacode: "306", state: "Saskatchewan, Canada"},
|
||||
{areacode: "307", state: "Wyoming"},
|
||||
|
||||
{areacode: "308", state: "Nebraska"},
|
||||
{areacode: "309", state: "Illinois"},
|
||||
{areacode: "310", state: "California"},
|
||||
{areacode: "312", state: "Illinois"},
|
||||
{areacode: "313", state: "Michigan"},
|
||||
{areacode: "314", state: "Missouri"},
|
||||
|
||||
{areacode: "315", state: "New York"},
|
||||
{areacode: "316", state: "Kansas"},
|
||||
{areacode: "317", state: "Indiana"},
|
||||
{areacode: "318", state: "Louisiana"},
|
||||
{areacode: "319", state: "Iowa"},
|
||||
{areacode: "320", state: "Minnesota"},
|
||||
|
||||
{areacode: "321", state: "Florida"},
|
||||
{areacode: "323", state: "California"},
|
||||
{areacode: "330", state: "Ohio"},
|
||||
{areacode: "331", state: "Illinois"},
|
||||
{areacode: "334", state: "Alabama"},
|
||||
{areacode: "336", state: "North Carolina"},
|
||||
|
||||
{areacode: "337", state: "Louisiana"},
|
||||
{areacode: "339", state: "Massachusetts"},
|
||||
{areacode: "340", state: "US Virgin Islands"},
|
||||
{areacode: "345", state: "Cayman Islands"},
|
||||
{areacode: "347", state: "New York"},
|
||||
{areacode: "351", state: "Massachusetts"},
|
||||
|
||||
{areacode: "352", state: "Florida"},
|
||||
{areacode: "360", state: "Washington"},
|
||||
{areacode: "361", state: "Texas"},
|
||||
{areacode: "386", state: "Florida"},
|
||||
{areacode: "401", state: "Rhode Island"},
|
||||
{areacode: "402", state: "Nebraska"},
|
||||
|
||||
{areacode: "403", state: "Alberta, Canada"},
|
||||
{areacode: "404", state: "Georgia"},
|
||||
{areacode: "405", state: "Oklahoma"},
|
||||
{areacode: "406", state: "Montana"},
|
||||
{areacode: "407", state: "Florida"},
|
||||
{areacode: "408", state: "California"},
|
||||
|
||||
{areacode: "409", state: "Texas"},
|
||||
{areacode: "410", state: "Maryland"},
|
||||
{areacode: "412", state: "Pennsylvania"},
|
||||
{areacode: "413", state: "Massachusetts"},
|
||||
{areacode: "414", state: "Wisconsin"},
|
||||
{areacode: "415", state: "California"},
|
||||
|
||||
{areacode: "416", state: "Ontario, Canada"},
|
||||
{areacode: "417", state: "Missouri"},
|
||||
{areacode: "418", state: "Quebec, Canada"},
|
||||
{areacode: "419", state: "Ohio"},
|
||||
{areacode: "423", state: "Tennessee"},
|
||||
{areacode: "424", state: "California"},
|
||||
|
||||
{areacode: "425", state: "Washington"},
|
||||
{areacode: "434", state: "Virginia"},
|
||||
{areacode: "435", state: "Utah"},
|
||||
{areacode: "440", state: "Ohio"},
|
||||
{areacode: "441", state: "Bermuda"},
|
||||
{areacode: "443", state: "Maryland"},
|
||||
|
||||
{areacode: "445", state: "Pennsylvania"},
|
||||
{areacode: "450", state: "Quebec, Canada"},
|
||||
{areacode: "464", state: "Illinois"},
|
||||
{areacode: "469", state: "Texas"},
|
||||
{areacode: "470", state: "Georgia"},
|
||||
{areacode: "473", state: "Grenada"},
|
||||
|
||||
{areacode: "475", state: "Connecticut"},
|
||||
{areacode: "478", state: "Georgia"},
|
||||
{areacode: "479", state: "Arkansas"},
|
||||
{areacode: "480", state: "Arizona"},
|
||||
{areacode: "484", state: "Pennsylvania"},
|
||||
{areacode: "501", state: "Arkansas"},
|
||||
|
||||
{areacode: "502", state: "Kentucky"},
|
||||
{areacode: "503", state: "Oregon"},
|
||||
{areacode: "504", state: "Louisiana"},
|
||||
{areacode: "505", state: "New Mexico"},
|
||||
{areacode: "506", state: "New Brunswick, Canada"},
|
||||
{areacode: "507", state: "Minnesota"},
|
||||
|
||||
{areacode: "508", state: "Massachusetts"},
|
||||
{areacode: "509", state: "Washington"},
|
||||
{areacode: "510", state: "California"},
|
||||
{areacode: "512", state: "Texas"},
|
||||
{areacode: "513", state: "Ohio"},
|
||||
{areacode: "514", state: "Quebec, Canada"},
|
||||
|
||||
{areacode: "515", state: "Iowa"},
|
||||
{areacode: "516", state: "New York"},
|
||||
{areacode: "517", state: "Michigan"},
|
||||
{areacode: "518", state: "New York"},
|
||||
{areacode: "519", state: "Ontario, Canada"},
|
||||
{areacode: "520", state: "Arizona"},
|
||||
|
||||
{areacode: "530", state: "California"},
|
||||
{areacode: "540", state: "Virginia"},
|
||||
{areacode: "541", state: "Oregon"},
|
||||
{areacode: "551", state: "New Jersey"},
|
||||
{areacode: "557", state: "Missouri"},
|
||||
{areacode: "559", state: "California"},
|
||||
|
||||
{areacode: "561", state: "Florida"},
|
||||
{areacode: "562", state: "California"},
|
||||
{areacode: "563", state: "Iowa"},
|
||||
{areacode: "564", state: "Washington"},
|
||||
{areacode: "567", state: "Ohio"},
|
||||
{areacode: "570", state: "Pennsylvania"},
|
||||
|
||||
{areacode: "571", state: "Virginia"},
|
||||
{areacode: "573", state: "Missouri"},
|
||||
{areacode: "574", state: "Indiana"},
|
||||
{areacode: "580", state: "Oklahoma"},
|
||||
{areacode: "585", state: "New York"},
|
||||
{areacode: "586", state: "Michigan"},
|
||||
|
||||
{areacode: "601", state: "Mississippi"},
|
||||
{areacode: "602", state: "Arizona"},
|
||||
{areacode: "603", state: "New Hampshire"},
|
||||
{areacode: "604", state: "British Columbia, Canada"},
|
||||
{areacode: "605", state: "South Dakota"},
|
||||
{areacode: "606", state: "Kentucky"},
|
||||
|
||||
{areacode: "607", state: "New York"},
|
||||
{areacode: "608", state: "Wisconsin"},
|
||||
{areacode: "609", state: "New Jersey"},
|
||||
{areacode: "610", state: "Pennsylvania"},
|
||||
{areacode: "612", state: "Minnesota"},
|
||||
{areacode: "613", state: "Ontario, Canada"},
|
||||
|
||||
{areacode: "614", state: "Ohio"},
|
||||
{areacode: "615", state: "Tennessee"},
|
||||
{areacode: "616", state: "Michigan"},
|
||||
{areacode: "617", state: "Massachusetts"},
|
||||
{areacode: "618", state: "Illinois"},
|
||||
{areacode: "619", state: "California"},
|
||||
|
||||
{areacode: "620", state: "Kansas"},
|
||||
{areacode: "623", state: "Arizona"},
|
||||
{areacode: "626", state: "California"},
|
||||
{areacode: "630", state: "Illinois"},
|
||||
{areacode: "631", state: "New York"},
|
||||
{areacode: "636", state: "Missouri"},
|
||||
|
||||
{areacode: "641", state: "Iowa"},
|
||||
{areacode: "646", state: "New York"},
|
||||
{areacode: "647", state: "Ontario, Canada"},
|
||||
{areacode: "649", state: "Turks and Caicos Islands"},
|
||||
{areacode: "650", state: "California"},
|
||||
{areacode: "651", state: "Minnesota"},
|
||||
|
||||
{areacode: "660", state: "Missouri"},
|
||||
{areacode: "661", state: "California"},
|
||||
{areacode: "662", state: "Mississippi"},
|
||||
{areacode: "664", state: "Montserrat"},
|
||||
{areacode: "667", state: "Maryland"},
|
||||
{areacode: "670", state: "CNMI"},
|
||||
|
||||
{areacode: "671", state: "Guam"},
|
||||
{areacode: "678", state: "Georgia"},
|
||||
{areacode: "682", state: "Texas"},
|
||||
{areacode: "701", state: "North Dakota"},
|
||||
{areacode: "702", state: "Nevada"},
|
||||
{areacode: "703", state: "Virginia"},
|
||||
|
||||
{areacode: "704", state: "North Carolina"},
|
||||
{areacode: "705", state: "Ontario, Canada"},
|
||||
{areacode: "706", state: "Georgia"},
|
||||
{areacode: "707", state: "California"},
|
||||
{areacode: "708", state: "Illinois"},
|
||||
{areacode: "709", state: "Newfoundland, Canada"},
|
||||
|
||||
{areacode: "712", state: "Iowa"},
|
||||
{areacode: "713", state: "Texas"},
|
||||
{areacode: "714", state: "California"},
|
||||
{areacode: "715", state: "Wisconsin"},
|
||||
{areacode: "716", state: "New York"},
|
||||
{areacode: "717", state: "Pennsylvania"},
|
||||
|
||||
{areacode: "718", state: "New York"},
|
||||
{areacode: "719", state: "Colorado"},
|
||||
{areacode: "720", state: "Colorado"},
|
||||
{areacode: "724", state: "Pennsylvania"},
|
||||
{areacode: "727", state: "Florida"},
|
||||
{areacode: "731", state: "Tennessee"},
|
||||
|
||||
{areacode: "732", state: "New Jersey"},
|
||||
{areacode: "734", state: "Michigan"},
|
||||
{areacode: "737", state: "Texas"},
|
||||
{areacode: "740", state: "Ohio"},
|
||||
{areacode: "754", state: "Florida"},
|
||||
{areacode: "757", state: "Viriginia"},
|
||||
|
||||
{areacode: "758", state: "St. Lucia"},
|
||||
{areacode: "760", state: "California"},
|
||||
{areacode: "763", state: "Minnesota"},
|
||||
{areacode: "765", state: "Indiana"},
|
||||
{areacode: "767", state: "Dominica"},
|
||||
{areacode: "770", state: "Georgia"},
|
||||
|
||||
{areacode: "772", state: "Florida"},
|
||||
{areacode: "773", state: "Illinois"},
|
||||
{areacode: "774", state: "Massachusetts"},
|
||||
{areacode: "775", state: "Nevada"},
|
||||
{areacode: "778", state: "British Columbia, Canada"},
|
||||
{areacode: "780", state: "Alberta, Canada"},
|
||||
|
||||
{areacode: "781", state: "Massachusetts"},
|
||||
{areacode: "784", state: "St. Vincent & Gren."},
|
||||
{areacode: "785", state: "Kansas"},
|
||||
{areacode: "786", state: "Florida"},
|
||||
{areacode: "787", state: "Puerto Rico"},
|
||||
|
||||
{areacode: "801", state: "Utah"},
|
||||
{areacode: "802", state: "Vermont"},
|
||||
{areacode: "803", state: "South Carolina"},
|
||||
{areacode: "804", state: "Virginia"},
|
||||
{areacode: "805", state: "California"},
|
||||
{areacode: "806", state: "Texas"},
|
||||
|
||||
{areacode: "807", state: "Ontario, Canada"},
|
||||
{areacode: "808", state: "Hawaii"},
|
||||
{areacode: "809", state: "Dominican Republic"},
|
||||
{areacode: "810", state: "Michigan"},
|
||||
{areacode: "812", state: "Indiana"},
|
||||
{areacode: "813", state: "Florida"},
|
||||
|
||||
{areacode: "814", state: "Pennsylvania"},
|
||||
{areacode: "815", state: "Illinois"},
|
||||
{areacode: "816", state: "Missouri"},
|
||||
{areacode: "817", state: "Texas"},
|
||||
{areacode: "818", state: "California"},
|
||||
{areacode: "819", state: "Quebec, Canada"},
|
||||
|
||||
{areacode: "828", state: "North Carolina"},
|
||||
{areacode: "830", state: "Texas"},
|
||||
{areacode: "831", state: "California"},
|
||||
{areacode: "832", state: "Texas"},
|
||||
{areacode: "835", state: "Pennsylvania"},
|
||||
{areacode: "843", state: "South Carolina"},
|
||||
|
||||
{areacode: "845", state: "New York"},
|
||||
{areacode: "847", state: "Illinois"},
|
||||
{areacode: "848", state: "New Jersey"},
|
||||
{areacode: "850", state: "Florida"},
|
||||
{areacode: "856", state: "New Jersey"},
|
||||
{areacode: "857", state: "Massachusetts"},
|
||||
|
||||
{areacode: "858", state: "California"},
|
||||
{areacode: "859", state: "Kentucky"},
|
||||
{areacode: "860", state: "Connecticut"},
|
||||
{areacode: "862", state: "New Jersey"},
|
||||
{areacode: "863", state: "Florida"},
|
||||
{areacode: "864", state: "South Carolina"},
|
||||
|
||||
{areacode: "865", state: "Tennessee"},
|
||||
{areacode: "867", state: "Yukon, NW Territories, Canada"},
|
||||
{areacode: "868", state: "Trinidad and Tobago"},
|
||||
{areacode: "869", state: "St. Kitts & Nevis"},
|
||||
{areacode: "870", state: "Arkansas"},
|
||||
|
||||
{areacode: "872", state: "Illinois"},
|
||||
{areacode: "876", state: "Jamaica"},
|
||||
{areacode: "878", state: "Pennsylvania"},
|
||||
{areacode: "901", state: "Tennessee"},
|
||||
{areacode: "902", state: "Nova Scotia, Canada"},
|
||||
{areacode: "903", state: "Texas"},
|
||||
|
||||
{areacode: "904", state: "Florida"},
|
||||
{areacode: "905", state: "Ontario, Canada"},
|
||||
{areacode: "906", state: "Michigan"},
|
||||
{areacode: "907", state: "Alaska"},
|
||||
{areacode: "908", state: "New Jersey"},
|
||||
{areacode: "909", state: "California"},
|
||||
|
||||
{areacode: "910", state: "North Carolina"},
|
||||
{areacode: "912", state: "Georgia"},
|
||||
{areacode: "913", state: "Kansas"},
|
||||
{areacode: "914", state: "New York"},
|
||||
{areacode: "915", state: "Texas"},
|
||||
{areacode: "916", state: "California"},
|
||||
|
||||
{areacode: "917", state: "New York"},
|
||||
{areacode: "918", state: "Oklahoma"},
|
||||
{areacode: "919", state: "North Carolina"},
|
||||
{areacode: "920", state: "Wisconsin"},
|
||||
{areacode: "925", state: "California"},
|
||||
{areacode: "928", state: "Arizona"},
|
||||
|
||||
{areacode: "931", state: "Tennessee"},
|
||||
{areacode: "936", state: "Texas"},
|
||||
{areacode: "937", state: "Ohio"},
|
||||
{areacode: "939", state: "Puerto Rico"},
|
||||
{areacode: "940", state: "Texas"},
|
||||
{areacode: "941", state: "Florida"},
|
||||
|
||||
{areacode: "947", state: "Michigan"},
|
||||
{areacode: "949", state: "California"},
|
||||
{areacode: "952", state: "Minnesota"},
|
||||
{areacode: "954", state: "Florida"},
|
||||
{areacode: "956", state: "Texas"},
|
||||
{areacode: "959", state: "Connecticut"},
|
||||
|
||||
{areacode: "970", state: "Colorado"},
|
||||
{areacode: "971", state: "Oregon"},
|
||||
{areacode: "972", state: "Texas"},
|
||||
{areacode: "973", state: "New Jersey"},
|
||||
{areacode: "975", state: "Missouri"},
|
||||
{areacode: "978", state: "Massachusetts"},
|
||||
|
||||
{areacode: "979", state: "Texas"},
|
||||
{areacode: "980", state: "North Carolina"},
|
||||
{areacode: "984", state: "North Carolina"},
|
||||
{areacode: "985", state: "Louisiana"},
|
||||
{areacode: "989", state: "Michigan"}
|
||||
]
|
||||
};
|
||||
808
www/extras/yui/examples/datatable/assets/php/JSON.php
Normal file
808
www/extras/yui/examples/datatable/assets/php/JSON.php
Normal file
|
|
@ -0,0 +1,808 @@
|
|||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
|
||||
|
||||
/* yadl_spaceid - Skip Stamping */
|
||||
|
||||
/**
|
||||
* Converts to and from JSON format.
|
||||
*
|
||||
* JSON (JavaScript Object Notation) is a lightweight data-interchange
|
||||
* format. It is easy for humans to read and write. It is easy for machines
|
||||
* to parse and generate. It is based on a subset of the JavaScript
|
||||
* Programming Language, Standard ECMA-262 3rd Edition - December 1999.
|
||||
* This feature can also be found in Python. JSON is a text format that is
|
||||
* completely language independent but uses conventions that are familiar
|
||||
* to programmers of the C-family of languages, including C, C++, C#, Java,
|
||||
* JavaScript, Perl, TCL, and many others. These properties make JSON an
|
||||
* ideal data-interchange language.
|
||||
*
|
||||
* This package provides a simple encoder and decoder for JSON notation. It
|
||||
* is intended for use with client-side Javascript applications that make
|
||||
* use of HTTPRequest to perform server communication functions - data can
|
||||
* be encoded into JSON notation for use in a client-side javascript, or
|
||||
* decoded from incoming Javascript requests. JSON format is native to
|
||||
* Javascript, and can be directly eval()'ed with no further parsing
|
||||
* overhead
|
||||
*
|
||||
* All strings should be in ASCII or UTF-8 format!
|
||||
*
|
||||
* LICENSE: Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the following
|
||||
* conditions are met: Redistributions of source code must retain the
|
||||
* above copyright notice, this list of conditions and the following
|
||||
* disclaimer. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following disclaimer
|
||||
* in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*
|
||||
* @category
|
||||
* @package Services_JSON
|
||||
* @author Michal Migurski <mike-json@teczno.com>
|
||||
* @author Matt Knapp <mdknapp[at]gmail[dot]com>
|
||||
* @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
|
||||
* @copyright 2005 Michal Migurski
|
||||
* @version CVS: $Id: JSON.php,v 1.2 2007/07/31 21:14:29 jennyhan Exp $
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php
|
||||
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
|
||||
*/
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_SLICE', 1);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_STR', 2);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_ARR', 3);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_OBJ', 4);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_CMT', 5);
|
||||
|
||||
/**
|
||||
* Behavior switch for Services_JSON::decode()
|
||||
*/
|
||||
define('SERVICES_JSON_LOOSE_TYPE', 16);
|
||||
|
||||
/**
|
||||
* Behavior switch for Services_JSON::decode()
|
||||
*/
|
||||
define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
|
||||
|
||||
/**
|
||||
* Converts to and from JSON format.
|
||||
*
|
||||
* Brief example of use:
|
||||
*
|
||||
* <code>
|
||||
* // create a new instance of Services_JSON
|
||||
* $json = new Services_JSON();
|
||||
*
|
||||
* // convert a complexe value to JSON notation, and send it to the browser
|
||||
* $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
|
||||
* $output = $json->encode($value);
|
||||
*
|
||||
* print($output);
|
||||
* // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
|
||||
*
|
||||
* // accept incoming POST data, assumed to be in JSON notation
|
||||
* $input = file_get_contents('php://input', 1000000);
|
||||
* $value = $json->decode($input);
|
||||
* </code>
|
||||
*/
|
||||
class Services_JSON
|
||||
{
|
||||
/**
|
||||
* constructs a new JSON instance
|
||||
*
|
||||
* @param int $use object behavior flags; combine with boolean-OR
|
||||
*
|
||||
* possible values:
|
||||
* - SERVICES_JSON_LOOSE_TYPE: loose typing.
|
||||
* "{...}" syntax creates associative arrays
|
||||
* instead of objects in decode().
|
||||
* - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
|
||||
* Values which can't be encoded (e.g. resources)
|
||||
* appear as NULL instead of throwing errors.
|
||||
* By default, a deeply-nested resource will
|
||||
* bubble up with an error, so all return values
|
||||
* from encode() should be checked with isError()
|
||||
*/
|
||||
function Services_JSON($use = 0)
|
||||
{
|
||||
$this->use = $use;
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a string from one UTF-16 char to one UTF-8 char
|
||||
*
|
||||
* Normally should be handled by mb_convert_encoding, but
|
||||
* provides a slower PHP-only method for installations
|
||||
* that lack the multibye string extension.
|
||||
*
|
||||
* @param string $utf16 UTF-16 character
|
||||
* @return string UTF-8 character
|
||||
* @access private
|
||||
*/
|
||||
function utf162utf8($utf16)
|
||||
{
|
||||
// oh please oh please oh please oh please oh please
|
||||
if(function_exists('mb_convert_encoding')) {
|
||||
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
|
||||
}
|
||||
|
||||
$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
|
||||
|
||||
switch(true) {
|
||||
case ((0x7F & $bytes) == $bytes):
|
||||
// this case should never be reached, because we are in ASCII range
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0x7F & $bytes);
|
||||
|
||||
case (0x07FF & $bytes) == $bytes:
|
||||
// return a 2-byte UTF-8 character
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0xC0 | (($bytes >> 6) & 0x1F))
|
||||
. chr(0x80 | ($bytes & 0x3F));
|
||||
|
||||
case (0xFFFF & $bytes) == $bytes:
|
||||
// return a 3-byte UTF-8 character
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0xE0 | (($bytes >> 12) & 0x0F))
|
||||
. chr(0x80 | (($bytes >> 6) & 0x3F))
|
||||
. chr(0x80 | ($bytes & 0x3F));
|
||||
}
|
||||
|
||||
// ignoring UTF-32 for now, sorry
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a string from one UTF-8 char to one UTF-16 char
|
||||
*
|
||||
* Normally should be handled by mb_convert_encoding, but
|
||||
* provides a slower PHP-only method for installations
|
||||
* that lack the multibye string extension.
|
||||
*
|
||||
* @param string $utf8 UTF-8 character
|
||||
* @return string UTF-16 character
|
||||
* @access private
|
||||
*/
|
||||
function utf82utf16($utf8)
|
||||
{
|
||||
// oh please oh please oh please oh please oh please
|
||||
if(function_exists('mb_convert_encoding')) {
|
||||
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
|
||||
}
|
||||
|
||||
switch(strlen($utf8)) {
|
||||
case 1:
|
||||
// this case should never be reached, because we are in ASCII range
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return $utf8;
|
||||
|
||||
case 2:
|
||||
// return a UTF-16 character from a 2-byte UTF-8 char
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0x07 & (ord($utf8{0}) >> 2))
|
||||
. chr((0xC0 & (ord($utf8{0}) << 6))
|
||||
| (0x3F & ord($utf8{1})));
|
||||
|
||||
case 3:
|
||||
// return a UTF-16 character from a 3-byte UTF-8 char
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr((0xF0 & (ord($utf8{0}) << 4))
|
||||
| (0x0F & (ord($utf8{1}) >> 2)))
|
||||
. chr((0xC0 & (ord($utf8{1}) << 6))
|
||||
| (0x7F & ord($utf8{2})));
|
||||
}
|
||||
|
||||
// ignoring UTF-32 for now, sorry
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* encodes an arbitrary variable into JSON format
|
||||
*
|
||||
* @param mixed $var any number, boolean, string, array, or object to be encoded.
|
||||
* see argument 1 to Services_JSON() above for array-parsing behavior.
|
||||
* if var is a strng, note that encode() always expects it
|
||||
* to be in ASCII or UTF-8 format!
|
||||
*
|
||||
* @return mixed JSON string representation of input var or an error if a problem occurs
|
||||
* @access public
|
||||
*/
|
||||
function encode($var)
|
||||
{
|
||||
switch (gettype($var)) {
|
||||
case 'boolean':
|
||||
return $var ? 'true' : 'false';
|
||||
|
||||
case 'NULL':
|
||||
return 'null';
|
||||
|
||||
case 'integer':
|
||||
return (int) $var;
|
||||
|
||||
case 'double':
|
||||
case 'float':
|
||||
return (float) $var;
|
||||
|
||||
case 'string':
|
||||
// STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
|
||||
$ascii = '';
|
||||
$strlen_var = strlen($var);
|
||||
|
||||
/*
|
||||
* Iterate over every character in the string,
|
||||
* escaping with a slash or encoding to UTF-8 where necessary
|
||||
*/
|
||||
for ($c = 0; $c < $strlen_var; ++$c) {
|
||||
|
||||
$ord_var_c = ord($var{$c});
|
||||
|
||||
switch (true) {
|
||||
case $ord_var_c == 0x08:
|
||||
$ascii .= '\b';
|
||||
break;
|
||||
case $ord_var_c == 0x09:
|
||||
$ascii .= '\t';
|
||||
break;
|
||||
case $ord_var_c == 0x0A:
|
||||
$ascii .= '\n';
|
||||
break;
|
||||
case $ord_var_c == 0x0C:
|
||||
$ascii .= '\f';
|
||||
break;
|
||||
case $ord_var_c == 0x0D:
|
||||
$ascii .= '\r';
|
||||
break;
|
||||
|
||||
case $ord_var_c == 0x22:
|
||||
case $ord_var_c == 0x2F:
|
||||
case $ord_var_c == 0x5C:
|
||||
// double quote, slash, slosh
|
||||
$ascii .= '\\'.$var{$c};
|
||||
break;
|
||||
|
||||
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
|
||||
// characters U-00000000 - U-0000007F (same as ASCII)
|
||||
$ascii .= $var{$c};
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xE0) == 0xC0):
|
||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c, ord($var{$c + 1}));
|
||||
$c += 1;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xF0) == 0xE0):
|
||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}));
|
||||
$c += 2;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xF8) == 0xF0):
|
||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}));
|
||||
$c += 3;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xFC) == 0xF8):
|
||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}),
|
||||
ord($var{$c + 4}));
|
||||
$c += 4;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xFE) == 0xFC):
|
||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}),
|
||||
ord($var{$c + 4}),
|
||||
ord($var{$c + 5}));
|
||||
$c += 5;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return '"'.$ascii.'"';
|
||||
|
||||
case 'array':
|
||||
/*
|
||||
* As per JSON spec if any array key is not an integer
|
||||
* we must treat the the whole array as an object. We
|
||||
* also try to catch a sparsely populated associative
|
||||
* array with numeric keys here because some JS engines
|
||||
* will create an array with empty indexes up to
|
||||
* max_index which can cause memory issues and because
|
||||
* the keys, which may be relevant, will be remapped
|
||||
* otherwise.
|
||||
*
|
||||
* As per the ECMA and JSON specification an object may
|
||||
* have any string as a property. Unfortunately due to
|
||||
* a hole in the ECMA specification if the key is a
|
||||
* ECMA reserved word or starts with a digit the
|
||||
* parameter is only accessible using ECMAScript's
|
||||
* bracket notation.
|
||||
*/
|
||||
|
||||
// treat as a JSON object
|
||||
if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
|
||||
$properties = array_map(array($this, 'name_value'),
|
||||
array_keys($var),
|
||||
array_values($var));
|
||||
|
||||
foreach($properties as $property) {
|
||||
if(Services_JSON::isError($property)) {
|
||||
return $property;
|
||||
}
|
||||
}
|
||||
|
||||
return '{' . join(',', $properties) . '}';
|
||||
}
|
||||
|
||||
// treat it like a regular array
|
||||
$elements = array_map(array($this, 'encode'), $var);
|
||||
|
||||
foreach($elements as $element) {
|
||||
if(Services_JSON::isError($element)) {
|
||||
return $element;
|
||||
}
|
||||
}
|
||||
|
||||
return '[' . join(',', $elements) . ']';
|
||||
|
||||
case 'object':
|
||||
$vars = get_object_vars($var);
|
||||
|
||||
$properties = array_map(array($this, 'name_value'),
|
||||
array_keys($vars),
|
||||
array_values($vars));
|
||||
|
||||
foreach($properties as $property) {
|
||||
if(Services_JSON::isError($property)) {
|
||||
return $property;
|
||||
}
|
||||
}
|
||||
|
||||
return '{' . join(',', $properties) . '}';
|
||||
|
||||
default:
|
||||
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
|
||||
? 'null'
|
||||
: new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* array-walking function for use in generating JSON-formatted name-value pairs
|
||||
*
|
||||
* @param string $name name of key to use
|
||||
* @param mixed $value reference to an array element to be encoded
|
||||
*
|
||||
* @return string JSON-formatted name-value pair, like '"name":value'
|
||||
* @access private
|
||||
*/
|
||||
function name_value($name, $value)
|
||||
{
|
||||
$encoded_value = $this->encode($value);
|
||||
|
||||
if(Services_JSON::isError($encoded_value)) {
|
||||
return $encoded_value;
|
||||
}
|
||||
|
||||
return $this->encode(strval($name)) . ':' . $encoded_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* reduce a string by removing leading and trailing comments and whitespace
|
||||
*
|
||||
* @param $str string string value to strip of comments and whitespace
|
||||
*
|
||||
* @return string string value stripped of comments and whitespace
|
||||
* @access private
|
||||
*/
|
||||
function reduce_string($str)
|
||||
{
|
||||
$str = preg_replace(array(
|
||||
|
||||
// eliminate single line comments in '// ...' form
|
||||
'#^\s*//(.+)$#m',
|
||||
|
||||
// eliminate multi-line comments in '/* ... */' form, at start of string
|
||||
'#^\s*/\*(.+)\*/#Us',
|
||||
|
||||
// eliminate multi-line comments in '/* ... */' form, at end of string
|
||||
'#/\*(.+)\*/\s*$#Us'
|
||||
|
||||
), '', $str);
|
||||
|
||||
// eliminate extraneous space
|
||||
return trim($str);
|
||||
}
|
||||
|
||||
/**
|
||||
* decodes a JSON string into appropriate variable
|
||||
*
|
||||
* @param string $str JSON-formatted string
|
||||
*
|
||||
* @return mixed number, boolean, string, array, or object
|
||||
* corresponding to given JSON input string.
|
||||
* See argument 1 to Services_JSON() above for object-output behavior.
|
||||
* Note that decode() always returns strings
|
||||
* in ASCII or UTF-8 format!
|
||||
* @access public
|
||||
*/
|
||||
function decode($str)
|
||||
{
|
||||
$str = $this->reduce_string($str);
|
||||
|
||||
switch (strtolower($str)) {
|
||||
case 'true':
|
||||
return true;
|
||||
|
||||
case 'false':
|
||||
return false;
|
||||
|
||||
case 'null':
|
||||
return null;
|
||||
|
||||
default:
|
||||
$m = array();
|
||||
|
||||
if (is_numeric($str)) {
|
||||
// Lookie-loo, it's a number
|
||||
|
||||
// This would work on its own, but I'm trying to be
|
||||
// good about returning integers where appropriate:
|
||||
// return (float)$str;
|
||||
|
||||
// Return float or int, as appropriate
|
||||
return ((float)$str == (integer)$str)
|
||||
? (integer)$str
|
||||
: (float)$str;
|
||||
|
||||
} elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
|
||||
// STRINGS RETURNED IN UTF-8 FORMAT
|
||||
$delim = substr($str, 0, 1);
|
||||
$chrs = substr($str, 1, -1);
|
||||
$utf8 = '';
|
||||
$strlen_chrs = strlen($chrs);
|
||||
|
||||
for ($c = 0; $c < $strlen_chrs; ++$c) {
|
||||
|
||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
||||
$ord_chrs_c = ord($chrs{$c});
|
||||
|
||||
switch (true) {
|
||||
case $substr_chrs_c_2 == '\b':
|
||||
$utf8 .= chr(0x08);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\t':
|
||||
$utf8 .= chr(0x09);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\n':
|
||||
$utf8 .= chr(0x0A);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\f':
|
||||
$utf8 .= chr(0x0C);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\r':
|
||||
$utf8 .= chr(0x0D);
|
||||
++$c;
|
||||
break;
|
||||
|
||||
case $substr_chrs_c_2 == '\\"':
|
||||
case $substr_chrs_c_2 == '\\\'':
|
||||
case $substr_chrs_c_2 == '\\\\':
|
||||
case $substr_chrs_c_2 == '\\/':
|
||||
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
|
||||
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
|
||||
$utf8 .= $chrs{++$c};
|
||||
}
|
||||
break;
|
||||
|
||||
case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
|
||||
// single, escaped unicode character
|
||||
$utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
|
||||
. chr(hexdec(substr($chrs, ($c + 4), 2)));
|
||||
$utf8 .= $this->utf162utf8($utf16);
|
||||
$c += 5;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
|
||||
$utf8 .= $chrs{$c};
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xE0) == 0xC0:
|
||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
||||
//see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 2);
|
||||
++$c;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xF0) == 0xE0:
|
||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 3);
|
||||
$c += 2;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xF8) == 0xF0:
|
||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 4);
|
||||
$c += 3;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xFC) == 0xF8:
|
||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 5);
|
||||
$c += 4;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xFE) == 0xFC:
|
||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 6);
|
||||
$c += 5;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $utf8;
|
||||
|
||||
} elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
|
||||
// array, or object notation
|
||||
|
||||
if ($str{0} == '[') {
|
||||
$stk = array(SERVICES_JSON_IN_ARR);
|
||||
$arr = array();
|
||||
} else {
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$stk = array(SERVICES_JSON_IN_OBJ);
|
||||
$obj = array();
|
||||
} else {
|
||||
$stk = array(SERVICES_JSON_IN_OBJ);
|
||||
$obj = new stdClass();
|
||||
}
|
||||
}
|
||||
|
||||
array_push($stk, array('what' => SERVICES_JSON_SLICE,
|
||||
'where' => 0,
|
||||
'delim' => false));
|
||||
|
||||
$chrs = substr($str, 1, -1);
|
||||
$chrs = $this->reduce_string($chrs);
|
||||
|
||||
if ($chrs == '') {
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
return $arr;
|
||||
|
||||
} else {
|
||||
return $obj;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//print("\nparsing {$chrs}\n");
|
||||
|
||||
$strlen_chrs = strlen($chrs);
|
||||
|
||||
for ($c = 0; $c <= $strlen_chrs; ++$c) {
|
||||
|
||||
$top = end($stk);
|
||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
||||
|
||||
if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
|
||||
// found a comma that is not inside a string, array, etc.,
|
||||
// OR we've reached the end of the character list
|
||||
$slice = substr($chrs, $top['where'], ($c - $top['where']));
|
||||
array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
|
||||
//print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
// we are in an array, so just push an element onto the stack
|
||||
array_push($arr, $this->decode($slice));
|
||||
|
||||
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
|
||||
// we are in an object, so figure
|
||||
// out the property name and set an
|
||||
// element in an associative array,
|
||||
// for now
|
||||
$parts = array();
|
||||
|
||||
if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
|
||||
// "name":value pair
|
||||
$key = $this->decode($parts[1]);
|
||||
$val = $this->decode($parts[2]);
|
||||
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$obj[$key] = $val;
|
||||
} else {
|
||||
$obj->$key = $val;
|
||||
}
|
||||
} elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
|
||||
// name:value pair, where name is unquoted
|
||||
$key = $parts[1];
|
||||
$val = $this->decode($parts[2]);
|
||||
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$obj[$key] = $val;
|
||||
} else {
|
||||
$obj->$key = $val;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
|
||||
// found a quote, and we are not inside a string
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
|
||||
//print("Found start of string at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == $top['delim']) &&
|
||||
($top['what'] == SERVICES_JSON_IN_STR) &&
|
||||
((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
|
||||
// found a quote, we're in a string, and it's not escaped
|
||||
// we know that it's not escaped becase there is _not_ an
|
||||
// odd number of backslashes at the end of the string so far
|
||||
array_pop($stk);
|
||||
//print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($chrs{$c} == '[') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a left-bracket, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
|
||||
//print("Found start of array at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
|
||||
// found a right-bracket, and we're in an array
|
||||
array_pop($stk);
|
||||
//print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($chrs{$c} == '{') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a left-brace, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
|
||||
//print("Found start of object at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
|
||||
// found a right-brace, and we're in an object
|
||||
array_pop($stk);
|
||||
//print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($substr_chrs_c_2 == '/*') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a comment start, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
|
||||
$c++;
|
||||
//print("Found start of comment at {$c}\n");
|
||||
|
||||
} elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
|
||||
// found a comment end, and we're in one now
|
||||
array_pop($stk);
|
||||
$c++;
|
||||
|
||||
for ($i = $top['where']; $i <= $c; ++$i)
|
||||
$chrs = substr_replace($chrs, ' ', $i, 1);
|
||||
|
||||
//print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
return $arr;
|
||||
|
||||
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
|
||||
return $obj;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Ultimately, this should just call PEAR::isError()
|
||||
*/
|
||||
function isError($data, $code = null)
|
||||
{
|
||||
if (class_exists('pear')) {
|
||||
return PEAR::isError($data, $code);
|
||||
} elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
|
||||
is_subclass_of($data, 'services_json_error'))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (class_exists('PEAR_Error')) {
|
||||
|
||||
class Services_JSON_Error extends PEAR_Error
|
||||
{
|
||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
/**
|
||||
* @todo Ultimately, this class shall be descended from PEAR_Error
|
||||
*/
|
||||
class Services_JSON_Error
|
||||
{
|
||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
5012
www/extras/yui/examples/datatable/assets/php/json5000_proxy.php
Normal file
5012
www/extras/yui/examples/datatable/assets/php/json5000_proxy.php
Normal file
File diff suppressed because it is too large
Load diff
1519
www/extras/yui/examples/datatable/assets/php/json_proxy.php
Normal file
1519
www/extras/yui/examples/datatable/assets/php/json_proxy.php
Normal file
File diff suppressed because it is too large
Load diff
10
www/extras/yui/examples/datatable/assets/php/text_proxy.txt
Normal file
10
www/extras/yui/examples/datatable/assets/php/text_proxy.txt
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
Domino's Pizza|615 Caliente Dr|Sunnyvale|(408) 732-3030|4|http://local.yahoo.com/details?id=21335892&stx=pizza&csz=Sunnyvale+CA&ed=17rS8q160Sy5Htog0TF1m1atNv01Iz7ySeGEMtCL4dJsf1ku0nhziD2qN5XcnHlJtDS4IydIbA--
|
||||
Pizza Depot|919 E Duane Ave|Sunnyvale|(408) 245-7760|3.5|http://local.yahoo.com/details?id=21332021&stx=pizza&csz=Sunnyvale+CA&ed=6tiAL6160Sx1XVIEu1zIWPu6fD8rJDV4.offJLNUTb1Ri2Q.R5oLTYvDCz8YmzivI7Bz0gfrpw--
|
||||
Pizza Hut|464 N Mathilda Ave|Sunnyvale|(408) 735-1900|2.5|http://local.yahoo.com/details?id=21340811&stx=pizza&csz=Sunnyvale+CA&ed=syVWvq160Szz0Q60Q8N7uetWGoUIbThLIdulmQLubJ29CuU7wpxDvDxrLF4md791a4jW7kNRr9eSVQ--
|
||||
Giovannis Pizzeria|1127 N Lawrence Expy|Sunnyvale|(408) 734-4221|4.5|http://local.yahoo.com/details?id=21341983&stx=pizza&csz=Sunnyvale+CA&ed=kYc.Ba160SxZddWADEWWMRsGo0KgZ6X22_QAgTZxq3OdfrVCfCdLU9mvvJeybt8XpDhMC58HjElJAiWi
|
||||
Round Table Pizza|415 N Mary Ave|Sunnyvale|(408) 733-1365|5|http://local.yahoo.com/details?id=21329046&stx=pizza&csz=Sunnyvale+CA&ed=OkhHFa160Sx2UXqpaqXDZAGyyKWrCO9wfqP24Mur1nNB2pqgQsi3DQxeSEK_Uj9fxQN4zNax
|
||||
Vitos Famous Pizza|1155 Reed Ave|Sunnyvale|(408) 246-8800|4.5|http://local.yahoo.com/details?id=21332026&stx=pizza&csz=Sunnyvale+CA&ed=QTqeMK160Sx0Mril0Jnu_RK0RF4vTvEspLb2s60hJTic2.RapYE82B6edOm18LAox7KOqkw-
|
||||
Round Table Pizza|101 Town And Countr|Sunnyvale|(408) 736-2242|3|http://local.yahoo.com/details?id=21340803&stx=pizza&csz=Sunnyvale+CA&ed=SiKr2K160SwJxDEvf_eAwROvFMpfCIqsVX3dSyYtvj6HomUPpdS92g9AIoaoZNtg.WNSGcT4hpk1JxxT
|
||||
Round Table Pizza|860 Old San Francisco Rd|Sunnyvale|(408) 245-9000|3|http://local.yahoo.com/details?id=21340791&stx=pizza&csz=Sunnyvale+CA&ed=NF3MAq160SzKHt2S1yk7tJKtIMvbW44yNlckp8Y5veL7w8DWvagJYLH2tGehl1cPcLGbR4kzMTi4cf1U7iP6YA--
|
||||
Domino's Pizza|992 W El Camino Real|Sunnyvale|(408) 736-3666|4|http://local.yahoo.com/details?id=21341882&stx=pizza&csz=Sunnyvale+CA&ed=_tzLZq160SyF.4GddMA07QiACQkYc84nqI0j3hvsAcfMemwlBCiezUltSm8_ppCH1Bo8SlklBj1QhuRp
|
||||
Little Caesars Pizza|1039 Sunnyvale Saratoga Rd|Sunnyvale|(408) 245-0607|3|http://local.yahoo.com/details?id=21330174&stx=pizza&csz=Sunnyvale+CA&ed=89myuK160Syd6uoWQ5fTb6uLid70P.ucvPaBKA92m7bc1aVSW5LGmRbGsSIqT8U5e2eA4Ki4nQHVAAhh5.SVNIAQ
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
Restaurant|Location|Town|Telephone|Stars|Url
|
||||
Domino's Pizza|615 Caliente Dr|Sunnyvale|(408) 732-3030|4|http://local.yahoo.com/details?id=21335892&stx=pizza&csz=Sunnyvale+CA&ed=17rS8q160Sy5Htog0TF1m1atNv01Iz7ySeGEMtCL4dJsf1ku0nhziD2qN5XcnHlJtDS4IydIbA--
|
||||
Pizza Depot|919 E Duane Ave|Sunnyvale|(408) 245-7760|3.5|http://local.yahoo.com/details?id=21332021&stx=pizza&csz=Sunnyvale+CA&ed=6tiAL6160Sx1XVIEu1zIWPu6fD8rJDV4.offJLNUTb1Ri2Q.R5oLTYvDCz8YmzivI7Bz0gfrpw--
|
||||
Pizza Hut|464 N Mathilda Ave|Sunnyvale|(408) 735-1900|2.5|http://local.yahoo.com/details?id=21340811&stx=pizza&csz=Sunnyvale+CA&ed=syVWvq160Szz0Q60Q8N7uetWGoUIbThLIdulmQLubJ29CuU7wpxDvDxrLF4md791a4jW7kNRr9eSVQ--
|
||||
Giovannis Pizzeria|1127 N Lawrence Expy|Sunnyvale|(408) 734-4221|4.5|http://local.yahoo.com/details?id=21341983&stx=pizza&csz=Sunnyvale+CA&ed=kYc.Ba160SxZddWADEWWMRsGo0KgZ6X22_QAgTZxq3OdfrVCfCdLU9mvvJeybt8XpDhMC58HjElJAiWi
|
||||
Round Table Pizza|415 N Mary Ave|Sunnyvale|(408) 733-1365|5|http://local.yahoo.com/details?id=21329046&stx=pizza&csz=Sunnyvale+CA&ed=OkhHFa160Sx2UXqpaqXDZAGyyKWrCO9wfqP24Mur1nNB2pqgQsi3DQxeSEK_Uj9fxQN4zNax
|
||||
Vitos Famous Pizza|1155 Reed Ave|Sunnyvale|(408) 246-8800|4.5|http://local.yahoo.com/details?id=21332026&stx=pizza&csz=Sunnyvale+CA&ed=QTqeMK160Sx0Mril0Jnu_RK0RF4vTvEspLb2s60hJTic2.RapYE82B6edOm18LAox7KOqkw-
|
||||
Round Table Pizza|101 Town And Countr|Sunnyvale|(408) 736-2242|3|http://local.yahoo.com/details?id=21340803&stx=pizza&csz=Sunnyvale+CA&ed=SiKr2K160SwJxDEvf_eAwROvFMpfCIqsVX3dSyYtvj6HomUPpdS92g9AIoaoZNtg.WNSGcT4hpk1JxxT
|
||||
Round Table Pizza|860 Old San Francisco Rd|Sunnyvale|(408) 245-9000|3|http://local.yahoo.com/details?id=21340791&stx=pizza&csz=Sunnyvale+CA&ed=NF3MAq160SzKHt2S1yk7tJKtIMvbW44yNlckp8Y5veL7w8DWvagJYLH2tGehl1cPcLGbR4kzMTi4cf1U7iP6YA--
|
||||
Domino's Pizza|992 W El Camino Real|Sunnyvale|(408) 736-3666|4|http://local.yahoo.com/details?id=21341882&stx=pizza&csz=Sunnyvale+CA&ed=_tzLZq160SyF.4GddMA07QiACQkYc84nqI0j3hvsAcfMemwlBCiezUltSm8_ppCH1Bo8SlklBj1QhuRp
|
||||
Little Caesars Pizza|1039 Sunnyvale Saratoga Rd|Sunnyvale|(408) 245-0607|3|http://local.yahoo.com/details?id=21330174&stx=pizza&csz=Sunnyvale+CA&ed=89myuK160Syd6uoWQ5fTb6uLid70P.ucvPaBKA92m7bc1aVSW5LGmRbGsSIqT8U5e2eA4Ki4nQHVAAhh5.SVNIAQ
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
/* yadl_spaceid - Skip Stamping */
|
||||
|
||||
// Yahoo! proxy
|
||||
|
||||
// Hard-code hostname and path:
|
||||
define ('PATH', 'http://local.yahooapis.com/LocalSearchService/V2/localSearch');
|
||||
|
||||
$type = "text/xml";
|
||||
|
||||
// Get all query params
|
||||
$query = "?";
|
||||
foreach ($_GET as $key => $value) {
|
||||
if(($key == "output") && ($value == "json")) {
|
||||
$type = "application/json";
|
||||
}
|
||||
$query .= urlencode($key)."=".urlencode($value)."&";
|
||||
}
|
||||
|
||||
foreach ($_POST as $key => $value) {
|
||||
if(($key == "output") && ($value == "json")) {
|
||||
$type = "application/json";
|
||||
}
|
||||
$query .= $key."=".$value."&";
|
||||
}
|
||||
$query .= "appid=YahooDemo";
|
||||
$url = PATH.$query;
|
||||
|
||||
|
||||
// Open the Curl session
|
||||
$session = curl_init($url);
|
||||
|
||||
// Don't return HTTP headers. Do return the contents of the call
|
||||
curl_setopt($session, CURLOPT_HEADER, false);
|
||||
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
// Make the call
|
||||
$response = curl_exec($session);
|
||||
|
||||
header("Content-Type: ".$type);
|
||||
echo $response;
|
||||
curl_close($session);
|
||||
|
||||
?>
|
||||
414
www/extras/yui/examples/datatable/dt_autocomplete.html
Normal file
414
www/extras/yui/examples/datatable/dt_autocomplete.html
Normal file
File diff suppressed because one or more lines are too long
158
www/extras/yui/examples/datatable/dt_autocomplete_clean.html
Normal file
158
www/extras/yui/examples/datatable/dt_autocomplete_clean.html
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
<!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=utf-8">
|
||||
<title>Datatable with Autocomplete</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/autocomplete/assets/skins/sam/autocomplete.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/connection/connection-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/json/json-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/autocomplete/autocomplete-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-min.js"></script>
|
||||
|
||||
<!--there is no custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
|
||||
<h1>Datatable with Autocomplete</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>This example uses two <a href="http://developer.yahoo.com/yui/autocomplete/">AutoComplete Controls</a> to populate a DataTable with data received via XHR from the Yahoo! Local webservice.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<style type="text/css">
|
||||
#autocomplete, #autocomplete_zip {
|
||||
height: 25px;
|
||||
}
|
||||
#dt_input, #dt_input_zip {
|
||||
position: static;
|
||||
width: 300px;
|
||||
}
|
||||
#dt_input_zip {
|
||||
width: 60px;
|
||||
}
|
||||
#dt_ac_container, #dt_ac_zip_container {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="autocomplete">
|
||||
<label for="dt_input">Search Term: </label><input id="dt_input" type="text" value="pizza">
|
||||
<div id="dt_ac_container"></div>
|
||||
</div>
|
||||
<div id="autocomplete_zip">
|
||||
<label for="dt_input_zip">Zip Code: </label><input id="dt_input_zip" type="text" value="94089">
|
||||
<div id="dt_ac_zip_container"></div>
|
||||
</div>
|
||||
|
||||
<div id="json"></div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var Dom = YAHOO.util.Dom,
|
||||
Event = YAHOO.util.Event,
|
||||
queryString = '&results=20&output=json',
|
||||
zip = null,
|
||||
myDataSource = null,
|
||||
myDataTable = null;
|
||||
|
||||
var getZip = function(query) {
|
||||
query = parseInt(query, 10);
|
||||
if (!YAHOO.lang.isNumber(query)) {
|
||||
query = zip;
|
||||
Dom.get('dt_input_zip').value = zip;
|
||||
YAHOO.log('Invalid zip code, must be a number', 'warn', 'example');
|
||||
}
|
||||
myDataSource.sendRequest('datatable=yes&zip=' + query + '&query=' + Dom.get('dt_input').value + queryString,
|
||||
myDataTable.onDataReturnInitializeTable, myDataTable);
|
||||
};
|
||||
var getTerms = function(query) {
|
||||
myDataSource.sendRequest('datatable=yes&query=' + query + '&zip=' + Dom.get('dt_input_zip').value + queryString,
|
||||
myDataTable.onDataReturnInitializeTable, myDataTable);
|
||||
};
|
||||
|
||||
Event.onDOMReady(function() {
|
||||
zip = Dom.get('dt_input_zip').value;
|
||||
|
||||
var oACDS = new YAHOO.util.FunctionDataSource(getTerms);
|
||||
oACDS.queryMatchContains = true;
|
||||
var oAutoComp = new YAHOO.widget.AutoComplete("dt_input","dt_ac_container", oACDS);
|
||||
|
||||
|
||||
var oACDSZip = new YAHOO.util.FunctionDataSource(getZip);
|
||||
oACDSZip.queryMatchContains = true;
|
||||
var oAutoCompZip = new YAHOO.widget.AutoComplete("dt_input_zip","dt_ac_zip_container", oACDSZip);
|
||||
//Don't query until we have 5 numbers for the zip code
|
||||
oAutoCompZip.minQueryLength = 5;
|
||||
|
||||
var formatUrl = function(elCell, oRecord, oColumn, sData) {
|
||||
elCell.innerHTML = "<a href='" + oRecord.getData("ClickUrl") + "' target='_blank'>" + sData + "</a>";
|
||||
};
|
||||
|
||||
var myColumnDefs = [
|
||||
{ key:"Title",
|
||||
label:"Name",
|
||||
sortable:true,
|
||||
formatter: formatUrl
|
||||
},
|
||||
{ key:"Phone" },
|
||||
{ key:"City" },
|
||||
{ key:"Rating.AverageRating",
|
||||
label:"Rating",
|
||||
formatter:YAHOO.widget.DataTable.formatNumber,
|
||||
sortable:true
|
||||
}
|
||||
];
|
||||
|
||||
myDataSource = new YAHOO.util.DataSource("assets/php/ylocal_proxy.php?");
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
|
||||
myDataSource.connXhrMode = "queueRequests";
|
||||
myDataSource.responseSchema = {
|
||||
resultsList: "ResultSet.Result",
|
||||
fields: [
|
||||
"Title",
|
||||
"Phone",
|
||||
"City",
|
||||
{
|
||||
key: "Rating.AverageRating",
|
||||
parser:"number"
|
||||
},
|
||||
"ClickUrl"
|
||||
]
|
||||
};
|
||||
|
||||
myDataTable = new YAHOO.widget.DataTable("json", myColumnDefs,
|
||||
myDataSource, {initialRequest: 'datatable=yes&query=' + Dom.get('dt_input').value + '&zip=' + Dom.get('dt_input_zip').value + queryString });
|
||||
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
418
www/extras/yui/examples/datatable/dt_autocomplete_log.html
Normal file
418
www/extras/yui/examples/datatable/dt_autocomplete_log.html
Normal file
File diff suppressed because one or more lines are too long
243
www/extras/yui/examples/datatable/dt_basic.html
Normal file
243
www/extras/yui/examples/datatable/dt_basic.html
Normal file
File diff suppressed because one or more lines are too long
84
www/extras/yui/examples/datatable/dt_basic_clean.html
Normal file
84
www/extras/yui/examples/datatable/dt_basic_clean.html
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
<!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=utf-8">
|
||||
<title>Basic Example</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/dragdrop/dragdrop-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
<style type="text/css">
|
||||
/* custom styles for this example */
|
||||
.yui-skin-sam .yui-dt-liner { white-space:nowrap; }
|
||||
</style>
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
|
||||
<h1>Basic Example</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>A demonstration of the DataTable's basic feature set.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="basic"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.Basic = function() {
|
||||
var myColumnDefs = [
|
||||
{key:"id", sortable:true, resizeable:true},
|
||||
{key:"date", formatter:YAHOO.widget.DataTable.formatDate, sortable:true, sortOptions:{defaultDir:YAHOO.widget.DataTable.CLASS_DESC},resizeable:true},
|
||||
{key:"quantity", formatter:YAHOO.widget.DataTable.formatNumber, sortable:true, resizeable:true},
|
||||
{key:"amount", formatter:YAHOO.widget.DataTable.formatCurrency, sortable:true, resizeable:true},
|
||||
{key:"title", sortable:true, resizeable:true}
|
||||
];
|
||||
|
||||
var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.bookorders);
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
myDataSource.responseSchema = {
|
||||
fields: ["id","date","quantity","amount","title"]
|
||||
};
|
||||
|
||||
var myDataTable = new YAHOO.widget.DataTable("basic",
|
||||
myColumnDefs, myDataSource, {caption:"DataTable Caption"});
|
||||
|
||||
return {
|
||||
oDS: myDataSource,
|
||||
oDT: myDataTable
|
||||
};
|
||||
}();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
247
www/extras/yui/examples/datatable/dt_basic_log.html
Normal file
247
www/extras/yui/examples/datatable/dt_basic_log.html
Normal file
File diff suppressed because one or more lines are too long
311
www/extras/yui/examples/datatable/dt_cellediting.html
Normal file
311
www/extras/yui/examples/datatable/dt_cellediting.html
Normal file
File diff suppressed because one or more lines are too long
104
www/extras/yui/examples/datatable/dt_cellediting_clean.html
Normal file
104
www/extras/yui/examples/datatable/dt_cellediting_clean.html
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
<!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=utf-8">
|
||||
<title>Inline Cell Editing</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/calendar/assets/skins/sam/calendar.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/calendar/calendar-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
<style type="text/css">
|
||||
/* custom styles for this example */
|
||||
.yui-skin-sam .yui-dt-col-address pre { font-family:arial;font-size:100%; } /* Use PRE in first col to preserve linebreaks*/
|
||||
</style>
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
|
||||
<h1>Inline Cell Editing</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>This example demonstrates basic inline cell editing features, as well as
|
||||
more complex customizations, such as input validation and click-to-save interactions.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="cellediting"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.InlineCellEditing = function() {
|
||||
// Custom formatter for "address" column to preserve line breaks
|
||||
var formatAddress = function(elCell, oRecord, oColumn, oData) {
|
||||
elCell.innerHTML = "<pre class=\"address\">" + oData + "</pre>";
|
||||
};
|
||||
|
||||
var myColumnDefs = [
|
||||
{key:"uneditable"},
|
||||
{key:"address", formatter:formatAddress, editor: new YAHOO.widget.TextareaCellEditor()},
|
||||
{key:"city", editor: new YAHOO.widget.TextboxCellEditor({disableBtns:true})},
|
||||
{key:"state", editor: new YAHOO.widget.DropdownCellEditor({dropdownOptions:YAHOO.example.Data.stateAbbrs,disableBtns:true})},
|
||||
{key:"amount", editor: new YAHOO.widget.TextboxCellEditor({validator:YAHOO.widget.DataTable.validateNumber})},
|
||||
{key:"active", editor: new YAHOO.widget.RadioCellEditor({radioOptions:["yes","no","maybe"],disableBtns:true})},
|
||||
{key:"colors", editor: new YAHOO.widget.CheckboxCellEditor({checkboxOptions:["red","yellow","blue"]})},
|
||||
{key:"last_login", formatter:YAHOO.widget.DataTable.formatDate, editor: new YAHOO.widget.DateCellEditor()}
|
||||
];
|
||||
|
||||
var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.addresses);
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
myDataSource.responseSchema = {
|
||||
fields: ["address","city","state","amount","active","colors",{key:"last_login",parser:"date"}]
|
||||
};
|
||||
|
||||
var myDataTable = new YAHOO.widget.DataTable("cellediting", myColumnDefs, myDataSource, {});
|
||||
|
||||
// Set up editing flow
|
||||
var highlightEditableCell = function(oArgs) {
|
||||
var elCell = oArgs.target;
|
||||
if(YAHOO.util.Dom.hasClass(elCell, "yui-dt-editable")) {
|
||||
this.highlightCell(elCell);
|
||||
}
|
||||
};
|
||||
myDataTable.subscribe("cellMouseoverEvent", highlightEditableCell);
|
||||
myDataTable.subscribe("cellMouseoutEvent", myDataTable.onEventUnhighlightCell);
|
||||
myDataTable.subscribe("cellClickEvent", myDataTable.onEventShowCellEditor);
|
||||
|
||||
return {
|
||||
oDS: myDataSource,
|
||||
oDT: myDataTable
|
||||
};
|
||||
}();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
315
www/extras/yui/examples/datatable/dt_cellediting_log.html
Normal file
315
www/extras/yui/examples/datatable/dt_cellediting_log.html
Normal file
File diff suppressed because one or more lines are too long
311
www/extras/yui/examples/datatable/dt_cellselect.html
Normal file
311
www/extras/yui/examples/datatable/dt_cellselect.html
Normal file
File diff suppressed because one or more lines are too long
121
www/extras/yui/examples/datatable/dt_cellselect_clean.html
Normal file
121
www/extras/yui/examples/datatable/dt_cellselect_clean.html
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
<!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=utf-8">
|
||||
<title>Cell Selection</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
<style type="text/css">
|
||||
/* custom styles for this example */
|
||||
.yui-skin-sam .yui-dt-body { cursor:pointer; } /* when cells are selectable */
|
||||
#cellrange, #singlecell { margin-top:2em; }
|
||||
</style>
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
|
||||
<h1>Cell Selection</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>These examples demonstrate "cellblock", "cellrange", and "singlecell"
|
||||
selection modes.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="cellblock"></div>
|
||||
<div id="cellrange"></div>
|
||||
<div id="singlecell"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.CellSelection = function() {
|
||||
var myColumnDefs = [
|
||||
{key:"col1", sortable:true},
|
||||
{key:"col2", sortable:true},
|
||||
{key:"col3", sortable:true},
|
||||
{key:"col4", sortable:true}
|
||||
];
|
||||
|
||||
var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.webstats);
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
myDataSource.responseSchema = {
|
||||
fields: ["col0","col1","col2","col3","col4"]
|
||||
};
|
||||
|
||||
var cellBlockSelectDataTable = new YAHOO.widget.DataTable("cellblock",
|
||||
myColumnDefs, myDataSource, {
|
||||
caption:"Cell-Block Selection Mode with Support for Modifier Keys",
|
||||
selectionMode:"cellblock"
|
||||
});
|
||||
|
||||
// Subscribe to events for cell selection
|
||||
cellBlockSelectDataTable.subscribe("cellMouseoverEvent", cellBlockSelectDataTable.onEventHighlightCell);
|
||||
cellBlockSelectDataTable.subscribe("cellMouseoutEvent", cellBlockSelectDataTable.onEventUnhighlightCell);
|
||||
cellBlockSelectDataTable.subscribe("cellClickEvent", cellBlockSelectDataTable.onEventSelectCell);
|
||||
cellBlockSelectDataTable.subscribe("cellSelectEvent", cellBlockSelectDataTable.clearTextSelection);
|
||||
|
||||
var cellRangeSelectDataTable = new YAHOO.widget.DataTable("cellrange",
|
||||
myColumnDefs, myDataSource, {
|
||||
caption:"Example: Cell-Range Selection Mode Support for Modifier Keys",
|
||||
selectionMode:"cellrange"
|
||||
});
|
||||
|
||||
// Subscribe to events for cell selection
|
||||
cellRangeSelectDataTable.subscribe("cellMouseoverEvent", cellRangeSelectDataTable.onEventHighlightCell);
|
||||
cellRangeSelectDataTable.subscribe("cellMouseoutEvent", cellRangeSelectDataTable.onEventUnhighlightCell);
|
||||
cellRangeSelectDataTable.subscribe("cellClickEvent", cellRangeSelectDataTable.onEventSelectCell);
|
||||
cellRangeSelectDataTable.subscribe("cellSelectEvent", cellRangeSelectDataTable.clearTextSelection);
|
||||
|
||||
var singleCellSelectDataTable = new YAHOO.widget.DataTable("singlecell",
|
||||
myColumnDefs, myDataSource, {
|
||||
caption:"Single-Cell Selection Mode with Modifier Keys Disabled",
|
||||
selectionMode:"singlecell"
|
||||
});
|
||||
|
||||
// Subscribe to events for cell selection
|
||||
singleCellSelectDataTable.subscribe("cellMouseoverEvent", singleCellSelectDataTable.onEventHighlightCell);
|
||||
singleCellSelectDataTable.subscribe("cellMouseoutEvent", singleCellSelectDataTable.onEventUnhighlightCell);
|
||||
singleCellSelectDataTable.subscribe("cellClickEvent", singleCellSelectDataTable.onEventSelectCell);
|
||||
singleCellSelectDataTable.subscribe("cellSelectEvent", singleCellSelectDataTable.clearTextSelection);
|
||||
|
||||
return {
|
||||
oDS: myDataSource,
|
||||
oDTCellBlockSelect: cellBlockSelectDataTable,
|
||||
oDTCellRangeSelect: cellRangeSelectDataTable,
|
||||
oDTSingleCellSelect: singleCellSelectDataTable
|
||||
};
|
||||
}();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
315
www/extras/yui/examples/datatable/dt_cellselect_log.html
Normal file
315
www/extras/yui/examples/datatable/dt_cellselect_log.html
Normal file
File diff suppressed because one or more lines are too long
292
www/extras/yui/examples/datatable/dt_clientpagination.html
Normal file
292
www/extras/yui/examples/datatable/dt_clientpagination.html
Normal file
File diff suppressed because one or more lines are too long
102
www/extras/yui/examples/datatable/dt_clientpagination_clean.html
Normal file
102
www/extras/yui/examples/datatable/dt_clientpagination_clean.html
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
<!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=utf-8">
|
||||
<title>Client-side Pagination</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/paginator/assets/skins/sam/paginator.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/connection/connection-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/json/json-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/paginator/paginator-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
<style type="text/css">
|
||||
#paginated {
|
||||
text-align: center;
|
||||
}
|
||||
#paginated table {
|
||||
margin-left:auto; margin-right:auto;
|
||||
}
|
||||
#paginated, #paginated .yui-dt-loading {
|
||||
text-align: center; background-color: transparent;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
|
||||
<h1>Client-side Pagination</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>This example retrieves a large data set in JSON format from a server script, then loads the data into a DataTable with client side pagination enabled.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="paginated"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.onDOMReady(function() {
|
||||
YAHOO.example.ClientPagination = function() {
|
||||
var myColumnDefs = [
|
||||
{key:"id", label:"ID"},
|
||||
{key:"name", label:"Name"},
|
||||
{key:"date", label:"Date"},
|
||||
{key:"price", label:"Price"},
|
||||
{key:"number", label:"Number"}
|
||||
];
|
||||
|
||||
var myDataSource = new YAHOO.util.DataSource("assets/php/json_proxy.php?");
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
|
||||
myDataSource.responseSchema = {
|
||||
resultsList: "records",
|
||||
fields: ["id","name","date","price","number"]
|
||||
};
|
||||
|
||||
var oConfigs = {
|
||||
paginator: new YAHOO.widget.Paginator({
|
||||
rowsPerPage: 15
|
||||
}),
|
||||
initialRequest: "results=504"
|
||||
};
|
||||
var myDataTable = new YAHOO.widget.DataTable("paginated", myColumnDefs,
|
||||
myDataSource, oConfigs);
|
||||
|
||||
return {
|
||||
oDS: myDataSource,
|
||||
oDT: myDataTable
|
||||
};
|
||||
}();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
296
www/extras/yui/examples/datatable/dt_clientpagination_log.html
Normal file
296
www/extras/yui/examples/datatable/dt_clientpagination_log.html
Normal file
File diff suppressed because one or more lines are too long
268
www/extras/yui/examples/datatable/dt_clientsorting.html
Normal file
268
www/extras/yui/examples/datatable/dt_clientsorting.html
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,94 @@
|
|||
<!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=utf-8">
|
||||
<title>Client-side Sorting</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-min.js"></script>
|
||||
|
||||
<!--there is no custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
|
||||
<h1>Client-side Sorting</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>A custom sort handler has been defined in this example to enable custom nested
|
||||
sorting, such that clicking on the "States" Column will sort by states, and then
|
||||
by area code.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="sort"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.CustomSort = function() {
|
||||
// Custom sort handler to sort by state and then by areacode
|
||||
// where a and b are Record instances to compare
|
||||
var sortStates = function(a, b, desc) {
|
||||
// Deal with empty values
|
||||
if(!YAHOO.lang.isValue(a)) {
|
||||
return (!YAHOO.lang.isValue(b)) ? 0 : 1;
|
||||
}
|
||||
else if(!YAHOO.lang.isValue(b)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// First compare by state
|
||||
var comp = YAHOO.util.Sort.compare;
|
||||
var compState = comp(a.getData("state"), b.getData("state"), desc);
|
||||
|
||||
// If states are equal, then compare by areacode
|
||||
return (compState !== 0) ? compState : comp(a.getData("areacode"), b.getData("areacode"), desc);
|
||||
};
|
||||
|
||||
var myColumnDefs = [
|
||||
{key:"areacode",label:"Area Codes",sortable:true},
|
||||
{key:"state",label:"States",sortable:true,sortOptions:{sortFunction:sortStates}}
|
||||
];
|
||||
|
||||
var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.areacodes.slice(0,25));
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
myDataSource.responseSchema = {
|
||||
fields: ["areacode","state"]
|
||||
};
|
||||
|
||||
var myDataTable = new YAHOO.widget.DataTable("sort", myColumnDefs,
|
||||
myDataSource, {sortedBy:{key:"areacode", dir:"asc"}});
|
||||
|
||||
return {
|
||||
oDS: myDataSource,
|
||||
oDT: myDataTable
|
||||
};
|
||||
}();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
272
www/extras/yui/examples/datatable/dt_clientsorting_log.html
Normal file
272
www/extras/yui/examples/datatable/dt_clientsorting_log.html
Normal file
File diff suppressed because one or more lines are too long
373
www/extras/yui/examples/datatable/dt_colshowhide.html
Normal file
373
www/extras/yui/examples/datatable/dt_colshowhide.html
Normal file
File diff suppressed because one or more lines are too long
375
www/extras/yui/examples/datatable/dt_colshowhide_log.html
Normal file
375
www/extras/yui/examples/datatable/dt_colshowhide_log.html
Normal file
File diff suppressed because one or more lines are too long
221
www/extras/yui/examples/datatable/dt_colshowhide_source.html
Normal file
221
www/extras/yui/examples/datatable/dt_colshowhide_source.html
Normal file
|
|
@ -0,0 +1,221 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
/* custom styles for this example */
|
||||
#dt-example {width:45em;margin:0 auto;}
|
||||
#dt-options {text-align:right;margin:1em 0;}
|
||||
#dt-dlg {visibility:hidden;border:1px solid #808080;background-color:#E3E3E3;}
|
||||
#dt-dlg .hd {font-weight:bold;padding:1em;background:none;background-color:#E3E3E3;border-bottom:0;}
|
||||
#dt-dlg .ft {text-align:right;padding:.5em;background-color:#E3E3E3;}
|
||||
#dt-dlg .bd {height:10em;margin:0 1em;overflow:auto;border:1px solid black;background-color:white;}
|
||||
#dt-dlg .dt-dlg-pickercol {clear:both;padding:.5em 1em 3em;border-bottom:1px solid gray;}
|
||||
#dt-dlg .dt-dlg-pickerkey {float:left;}
|
||||
#dt-dlg .dt-dlg-pickerbtns {float:right;}
|
||||
|
||||
/* Container workarounds for Mac Gecko scrollbar issues */
|
||||
.yui-panel-container.hide-scrollbars #dt-dlg .bd {
|
||||
/* Hide scrollbars by default for Gecko on OS X */
|
||||
overflow: hidden;
|
||||
}
|
||||
.yui-panel-container.show-scrollbars #dt-dlg .bd {
|
||||
/* Show scrollbars for Gecko on OS X when the Panel is visible */
|
||||
overflow: auto;
|
||||
}
|
||||
#dt-dlg_c .underlay {overflow:hidden;}
|
||||
|
||||
|
||||
/* rounded corners */
|
||||
#dt-dlg .corner_tr {
|
||||
background-image: url( assets/img/tr.gif);
|
||||
position: absolute;
|
||||
background-repeat: no-repeat;
|
||||
top: -1px;
|
||||
right: -1px;
|
||||
height: 4px;
|
||||
width: 4px;
|
||||
}
|
||||
#dt-dlg .corner_tl {
|
||||
background-image: url( assets/img/tl.gif);
|
||||
background-repeat: no-repeat;
|
||||
position: absolute;
|
||||
top: -1px;
|
||||
left: -1px;
|
||||
height: 4px;
|
||||
width: 4px;
|
||||
}
|
||||
#dt-dlg .corner_br {
|
||||
background-image: url( assets/img/br.gif);
|
||||
position: absolute;
|
||||
background-repeat: no-repeat;
|
||||
bottom: -1px;
|
||||
right: -1px;
|
||||
height: 4px;
|
||||
width: 4px;
|
||||
}
|
||||
#dt-dlg .corner_bl {
|
||||
background-image: url( assets/img/bl.gif);
|
||||
background-repeat: no-repeat;
|
||||
position: absolute;
|
||||
bottom: -1px;
|
||||
left: -1px;
|
||||
height: 4px;
|
||||
width: 4px;
|
||||
}
|
||||
|
||||
.inprogress {position:absolute;} /* transitional progressive enhancement state */
|
||||
|
||||
.yui-dt-liner {white-space:nowrap;}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="yui-skin-sam">
|
||||
<h1>Showing, Hiding, and Reordering Columns</h1>
|
||||
|
||||
<p>This example uses the Dialog and Button widgets to interactively show and hide Columns. Columns are also reorderable via built-in integration with the Drag and Drop Utility.</p>
|
||||
|
||||
<div id="dt-example">
|
||||
<div id="dt-options"><a id="dt-options-link" href="fallbacklink.html">Table Options</a></div>
|
||||
<div id="columnshowhide"></div>
|
||||
</div>
|
||||
|
||||
<div id="dt-dlg" class="inprogress">
|
||||
<span class="corner_tr"></span>
|
||||
<span class="corner_tl"></span>
|
||||
<span class="corner_br"></span>
|
||||
<span class="corner_bl"></span>
|
||||
<div class="hd">
|
||||
Choose which columns you would like to see:
|
||||
</div>
|
||||
<div id="dt-dlg-picker" class="bd">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="../../build/yuiloader/yuiloader.js"></script>
|
||||
<script type="text/javascript" src="./assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
var loader = new YAHOO.util.YUILoader();
|
||||
loader.insert({
|
||||
require: ["fonts", "dragdrop", "container", "button", "datatable"],
|
||||
base: '../../build/',
|
||||
filter: 'debug',
|
||||
allowRollup: false,
|
||||
onSuccess: function() {
|
||||
YAHOO.example.ColumnShowHide = function() {
|
||||
// Define Columns
|
||||
var myColumnDefs = [
|
||||
{key:"address"},
|
||||
{key:"city"},
|
||||
{key:"state"},
|
||||
{key:"amount"},
|
||||
{key:"active"},
|
||||
{key:"colors"},
|
||||
{key:"last_login", formatter:YAHOO.widget.DataTable.formatDate}
|
||||
];
|
||||
|
||||
// Create DataSource
|
||||
var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.addresses);
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
myDataSource.responseSchema = {
|
||||
fields: ["address","city","state","amount","active","colors",{key:"last_login",parser:"date"}]
|
||||
};
|
||||
|
||||
// Create DataTable
|
||||
var myDataTable = new YAHOO.widget.DataTable("columnshowhide", myColumnDefs, myDataSource, {draggableColumns:true});
|
||||
|
||||
// Shows dialog, creating one when necessary
|
||||
var newCols = true;
|
||||
var showDlg = function(e) {
|
||||
YAHOO.util.Event.stopEvent(e);
|
||||
|
||||
if(newCols) {
|
||||
// Populate Dialog
|
||||
// Using a template to create elements for the SimpleDialog
|
||||
var allColumns = myDataTable.getColumnSet().keys;
|
||||
var elPicker = YAHOO.util.Dom.get("dt-dlg-picker");
|
||||
var elTemplateCol = document.createElement("div");
|
||||
YAHOO.util.Dom.addClass(elTemplateCol, "dt-dlg-pickercol");
|
||||
var elTemplateKey = elTemplateCol.appendChild(document.createElement("span"));
|
||||
YAHOO.util.Dom.addClass(elTemplateKey, "dt-dlg-pickerkey");
|
||||
var elTemplateBtns = elTemplateCol.appendChild(document.createElement("span"));
|
||||
YAHOO.util.Dom.addClass(elTemplateBtns, "dt-dlg-pickerbtns");
|
||||
var onclickObj = {fn:handleButtonClick, obj:this, scope:false };
|
||||
|
||||
// Create one section in the SimpleDialog for each Column
|
||||
var elColumn, elKey, elButton, oButtonGrp;
|
||||
for(var i=0,l=allColumns.length;i<l;i++) {
|
||||
var oColumn = allColumns[i];
|
||||
|
||||
// Use the template
|
||||
elColumn = elTemplateCol.cloneNode(true);
|
||||
|
||||
// Write the Column key
|
||||
elKey = elColumn.firstChild;
|
||||
elKey.innerHTML = oColumn.getKey();
|
||||
|
||||
// Create a ButtonGroup
|
||||
oButtonGrp = new YAHOO.widget.ButtonGroup({
|
||||
id: "buttongrp"+i,
|
||||
name: oColumn.getKey(),
|
||||
container: elKey.nextSibling
|
||||
});
|
||||
oButtonGrp.addButtons([
|
||||
{ label: "Show", value: "Show", checked: ((!oColumn.hidden)), onclick: onclickObj},
|
||||
{ label: "Hide", value: "Hide", checked: ((oColumn.hidden)), onclick: onclickObj}
|
||||
]);
|
||||
|
||||
elPicker.appendChild(elColumn);
|
||||
}
|
||||
newCols = false;
|
||||
}
|
||||
myDlg.show();
|
||||
};
|
||||
var hideDlg = function(e) {
|
||||
this.hide();
|
||||
};
|
||||
var handleButtonClick = function(e, oSelf) {
|
||||
var sKey = this.get("name");
|
||||
if(this.get("value") === "Hide") {
|
||||
// Hides a Column
|
||||
myDataTable.hideColumn(sKey);
|
||||
}
|
||||
else {
|
||||
// Shows a Column
|
||||
myDataTable.showColumn(sKey);
|
||||
}
|
||||
};
|
||||
|
||||
// Create the SimpleDialog
|
||||
YAHOO.util.Dom.removeClass("dt-dlg", "inprogress");
|
||||
var myDlg = new YAHOO.widget.SimpleDialog("dt-dlg", {
|
||||
width: "30em",
|
||||
visible: false,
|
||||
modal: true,
|
||||
buttons: [
|
||||
{ text:"Close", handler:hideDlg }
|
||||
],
|
||||
fixedcenter: true,
|
||||
constrainToViewport: true
|
||||
});
|
||||
myDlg.render();
|
||||
|
||||
// Nulls out myDlg to force a new one to be created
|
||||
myDataTable.subscribe("columnReorderEvent", function(){
|
||||
newCols = true;
|
||||
YAHOO.util.Event.purgeElement("dt-dlg-picker", true);
|
||||
YAHOO.util.Dom.get("dt-dlg-picker").innerHTML = "";
|
||||
}, this, true);
|
||||
|
||||
// Hook up the SimpleDialog to the link
|
||||
YAHOO.util.Event.addListener("dt-options-link", "click", showDlg, this, true);
|
||||
|
||||
return {
|
||||
oDS: myDataSource,
|
||||
oDT: myDataTable
|
||||
};
|
||||
}();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
348
www/extras/yui/examples/datatable/dt_complex.html
Normal file
348
www/extras/yui/examples/datatable/dt_complex.html
Normal file
File diff suppressed because one or more lines are too long
135
www/extras/yui/examples/datatable/dt_complex_clean.html
Normal file
135
www/extras/yui/examples/datatable/dt_complex_clean.html
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
<!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=utf-8">
|
||||
<title>Complex Example of Multiple Features</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/paginator/assets/skins/sam/paginator.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/utilities/utilities.js"></script>
|
||||
<script type="text/javascript" src="../../build/paginator/paginator-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
|
||||
<h1>Complex Example of Multiple Features</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>A demonstration of several DataTable features combined in one instance. The
|
||||
features implemented in this example require the Drag and Drop and Animation
|
||||
utilities.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="complex"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.MultipleFeatures = function() {
|
||||
// Custom sort handler to sort by state and then by areacode
|
||||
// where a and b are Record instances to compare
|
||||
var sortStates = function(a, b, desc) {
|
||||
// Deal with empty values
|
||||
if(!YAHOO.lang.isValue(a)) {
|
||||
return (!YAHOO.lang.isValue(b)) ? 0 : 1;
|
||||
}
|
||||
else if(!YAHOO.lang.isValue(b)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// First compare by state
|
||||
var comp = YAHOO.util.Sort.compare;
|
||||
var compState = comp(a.getData("state"), b.getData("state"), desc);
|
||||
|
||||
// If states are equal, then compare by areacode
|
||||
return (compState !== 0) ? compState : comp(a.getData("areacode"), b.getData("areacode"), desc);
|
||||
};
|
||||
|
||||
var myColumnDefs = [
|
||||
{key:"areacode",label:"Area Codes",width:100,resizeable:true,sortable:true},
|
||||
{key:"state",label:"States",width:250,resizeable:true,sortable:true,
|
||||
sortOptions:{sortFunction:sortStates}},
|
||||
{key:"notes",label:"Notes (editable)",editor:"textbox",resizeable:true,sortable:true}
|
||||
];
|
||||
|
||||
var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.areacodes);
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
myDataSource.responseSchema = {
|
||||
fields: ["areacode","state"]
|
||||
};
|
||||
|
||||
var myConfigs = {
|
||||
sortedBy:{key:"areacode",dir:"asc"},
|
||||
paginator: new YAHOO.widget.Paginator({
|
||||
rowsPerPage: 25,
|
||||
template: YAHOO.widget.Paginator.TEMPLATE_ROWS_PER_PAGE,
|
||||
rowsPerPageOptions: [10,25,50,100],
|
||||
pageLinks: 5
|
||||
})
|
||||
}
|
||||
|
||||
var myDataTable = new YAHOO.widget.DataTable("complex", myColumnDefs, myDataSource, myConfigs);
|
||||
myDataTable.subscribe("rowClickEvent",myDataTable.onEventSelectRow);
|
||||
myDataTable.subscribe("cellDblclickEvent",myDataTable.onEventShowCellEditor);
|
||||
myDataTable.subscribe("editorBlurEvent", myDataTable.onEventSaveCellEditor);
|
||||
|
||||
// When cell is edited, pulse the color of the row yellow
|
||||
var onCellEdit = function(oArgs) {
|
||||
var elCell = oArgs.editor.getTdEl();
|
||||
var oOldData = oArgs.oldData;
|
||||
var oNewData = oArgs.newData;
|
||||
|
||||
// Grab the row el and the 2 colors
|
||||
var elRow = this.getTrEl(elCell);
|
||||
var origColor = YAHOO.util.Dom.getStyle(elRow.cells[0], "backgroundColor");
|
||||
var pulseColor = "#ff0";
|
||||
|
||||
// Create a temp anim instance that nulls out when anim is complete
|
||||
var rowColorAnim = new YAHOO.util.ColorAnim(elRow.cells, {
|
||||
backgroundColor:{to:origColor, from:pulseColor}, duration:2});
|
||||
var onComplete = function() {
|
||||
rowColorAnim = null;
|
||||
YAHOO.util.Dom.setStyle(elRow.cells, "backgroundColor", "");
|
||||
}
|
||||
rowColorAnim.onComplete.subscribe(onComplete);
|
||||
rowColorAnim.animate();
|
||||
}
|
||||
myDataTable.subscribe("editorSaveEvent", onCellEdit);
|
||||
|
||||
return {
|
||||
oDS: myDataSource,
|
||||
oDT: myDataTable
|
||||
};
|
||||
}();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
352
www/extras/yui/examples/datatable/dt_complex_log.html
Normal file
352
www/extras/yui/examples/datatable/dt_complex_log.html
Normal file
File diff suppressed because one or more lines are too long
309
www/extras/yui/examples/datatable/dt_contextmenu.html
Normal file
309
www/extras/yui/examples/datatable/dt_contextmenu.html
Normal file
File diff suppressed because one or more lines are too long
115
www/extras/yui/examples/datatable/dt_contextmenu_clean.html
Normal file
115
www/extras/yui/examples/datatable/dt_contextmenu_clean.html
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
<!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=utf-8">
|
||||
<title>Context Menu Integration</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/menu/assets/skins/sam/menu.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/container/container_core-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/menu/menu-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
<style type="text/css">
|
||||
div.yuimenu .bd {
|
||||
zoom: normal;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
|
||||
<h1>Context Menu Integration</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>Right-click on a row to see the ContextMenu integration in action. For more
|
||||
information on using the ContextMenu class please refer to the
|
||||
<a href="http://developer.yahoo.com/yui/menu/">documentation for the Menu control.</a></p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="myContainer"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.ContextMenu = function() {
|
||||
var myColumnDefs = [
|
||||
{key:"SKU", sortable:true},
|
||||
{key:"Quantity", sortable:true},
|
||||
{key:"Item", sortable:true},
|
||||
{key:"Description"}
|
||||
];
|
||||
|
||||
var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.inventory);
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
myDataSource.responseSchema = {
|
||||
fields: ["SKU","Quantity","Item","Description"]
|
||||
};
|
||||
|
||||
var myDataTable = new YAHOO.widget.DataTable("myContainer", myColumnDefs, myDataSource);
|
||||
|
||||
var onContextMenuClick = function(p_sType, p_aArgs, p_myDataTable) {
|
||||
var task = p_aArgs[1];
|
||||
if(task) {
|
||||
// Extract which TR element triggered the context menu
|
||||
var elRow = this.contextEventTarget;
|
||||
elRow = p_myDataTable.getTrEl(elRow);
|
||||
|
||||
if(elRow) {
|
||||
switch(task.index) {
|
||||
case 0: // Delete row upon confirmation
|
||||
var oRecord = p_myDataTable.getRecord(elRow);
|
||||
if(confirm("Are you sure you want to delete SKU " +
|
||||
oRecord.getData("SKU") + " (" +
|
||||
oRecord.getData("Description") + ")?")) {
|
||||
p_myDataTable.deleteRow(elRow);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var myContextMenu = new YAHOO.widget.ContextMenu("mycontextmenu",
|
||||
{trigger:myDataTable.getTbodyEl()});
|
||||
myContextMenu.addItem("Delete Item");
|
||||
// Render the ContextMenu instance to the parent container of the DataTable
|
||||
myContextMenu.render("myContainer");
|
||||
myContextMenu.clickEvent.subscribe(onContextMenuClick, myDataTable);
|
||||
|
||||
return {
|
||||
oDS: myDataSource,
|
||||
oDT: myDataTable
|
||||
};
|
||||
}();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
313
www/extras/yui/examples/datatable/dt_contextmenu_log.html
Normal file
313
www/extras/yui/examples/datatable/dt_contextmenu_log.html
Normal file
File diff suppressed because one or more lines are too long
322
www/extras/yui/examples/datatable/dt_dynamicdata.html
Normal file
322
www/extras/yui/examples/datatable/dt_dynamicdata.html
Normal file
File diff suppressed because one or more lines are too long
110
www/extras/yui/examples/datatable/dt_dynamicdata_clean.html
Normal file
110
www/extras/yui/examples/datatable/dt_dynamicdata_clean.html
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
<!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=utf-8">
|
||||
<title>Server-side Pagination and Sorting for Dynamic Data</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/paginator/assets/skins/sam/paginator.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/connection/connection-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/json/json-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/paginator/paginator-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-min.js"></script>
|
||||
|
||||
<!--there is no custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
|
||||
<h1>Server-side Pagination and Sorting for Dynamic Data</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>This example enables server-side sorting and pagination for data that is
|
||||
dynamic in nature.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="dynamicdata"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
YAHOO.example.DynamicData = function() {
|
||||
// Column definitions
|
||||
var myColumnDefs = [ // sortable:true enables sorting
|
||||
{key:"id", label:"ID", sortable:true},
|
||||
{key:"name", label:"Name", sortable:true},
|
||||
{key:"date", label:"Date", sortable:true, formatter:"date"},
|
||||
{key:"price", label:"Price", sortable:true},
|
||||
{key:"number", label:"Number", sortable:true}
|
||||
];
|
||||
|
||||
// Custom parser
|
||||
var stringToDate = function(sData) {
|
||||
var array = sData.split("-");
|
||||
return new Date(array[1] + " " + array[0] + ", " + array[2]);
|
||||
};
|
||||
|
||||
// DataSource instance
|
||||
var myDataSource = new YAHOO.util.DataSource("assets/php/json_proxy.php?");
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
|
||||
myDataSource.responseSchema = {
|
||||
resultsList: "records",
|
||||
fields: [
|
||||
{key:"id", parser:"number"},
|
||||
{key:"name"},
|
||||
{key:"date", parser:stringToDate},
|
||||
{key:"price",parser:"number"},
|
||||
{key:"number",parser:"number"}
|
||||
],
|
||||
metaFields: {
|
||||
totalRecords: "totalRecords" // Access to value in the server response
|
||||
}
|
||||
};
|
||||
|
||||
// DataTable configuration
|
||||
var myConfigs = {
|
||||
initialRequest: "sort=id&dir=asc&startIndex=0&results=25", // Initial request for first page of data
|
||||
dynamicData: true, // Enables dynamic server-driven data
|
||||
sortedBy : {key:"id", dir:YAHOO.widget.DataTable.CLASS_ASC}, // Sets UI initial sort arrow
|
||||
paginator: new YAHOO.widget.Paginator({ rowsPerPage:25 }) // Enables pagination
|
||||
};
|
||||
|
||||
// DataTable instance
|
||||
var myDataTable = new YAHOO.widget.DataTable("dynamicdata", myColumnDefs, myDataSource, myConfigs);
|
||||
// Update totalRecords on the fly with value from server
|
||||
myDataTable.handleDataReturnPayload = function(oRequest, oResponse, oPayload) {
|
||||
oPayload.totalRecords = oResponse.meta.totalRecords;
|
||||
return oPayload;
|
||||
}
|
||||
|
||||
return {
|
||||
ds: myDataSource,
|
||||
dt: myDataTable
|
||||
};
|
||||
|
||||
}();
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
326
www/extras/yui/examples/datatable/dt_dynamicdata_log.html
Normal file
326
www/extras/yui/examples/datatable/dt_dynamicdata_log.html
Normal file
File diff suppressed because one or more lines are too long
359
www/extras/yui/examples/datatable/dt_enhanced.html
Normal file
359
www/extras/yui/examples/datatable/dt_enhanced.html
Normal file
File diff suppressed because one or more lines are too long
148
www/extras/yui/examples/datatable/dt_enhanced_clean.html
Normal file
148
www/extras/yui/examples/datatable/dt_enhanced_clean.html
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
<!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=utf-8">
|
||||
<title>Progressive Enhancement</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-min.js"></script>
|
||||
|
||||
<!--there is no custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
|
||||
<h1>Progressive Enhancement</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>This example creates a DataTable instance based on markup that already exists
|
||||
on the page. By progressively enhancing markup with higher order functionality,
|
||||
users who do not have JavaScript enabled are still able to view the page's content
|
||||
and experience core functionality.</p>
|
||||
|
||||
<p>In this example's code, note that we listen for the window "load" event
|
||||
before calling our function to be sure that the original table markup is fully
|
||||
rendered and available as a DataSource source for our DataTable instance.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="markup">
|
||||
<table id="accounts">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Due Date</th>
|
||||
<th>Account Number</th>
|
||||
<th>Quantity</th>
|
||||
<th>Amount Due</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>1/23/1999</td>
|
||||
<td>29e8548592d8c82</td>
|
||||
<td>12</td>
|
||||
<td>$150.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>5/19/1999</td>
|
||||
<td>83849</td>
|
||||
<td>8</td>
|
||||
<td>$60.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8/9/1999</td>
|
||||
<td>11348</td>
|
||||
<td>1</td>
|
||||
<td>$34.99</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1/23/2000</td>
|
||||
<td>29e8548592d8c82</td>
|
||||
<td>10</td>
|
||||
<td>$1.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>4/28/2000</td>
|
||||
<td>37892857482836437378273</td>
|
||||
<td>123</td>
|
||||
<td>$33.32</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1/23/2001</td>
|
||||
<td>83849</td>
|
||||
<td>5</td>
|
||||
<td>$15.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>9/30/2001</td>
|
||||
<td>224747</td>
|
||||
<td>14</td>
|
||||
<td>$56.78</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.EnhanceFromMarkup = function() {
|
||||
var myColumnDefs = [
|
||||
{key:"due",label:"Due Date",formatter:YAHOO.widget.DataTable.formatDate,sortable:true},
|
||||
{key:"account",label:"Account Number", sortable:true},
|
||||
{key:"quantity",label:"Quantity",formatter:YAHOO.widget.DataTable.formatNumber,sortable:true},
|
||||
{key:"amount",label:"Amount Due",formatter:YAHOO.widget.DataTable.formatCurrency,sortable:true}
|
||||
];
|
||||
|
||||
var parseNumberFromCurrency = function(sString) {
|
||||
// Remove dollar sign and make it a float
|
||||
return parseFloat(sString.substring(1));
|
||||
};
|
||||
|
||||
var myDataSource = new YAHOO.util.DataSource(YAHOO.util.Dom.get("accounts"));
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
|
||||
myDataSource.responseSchema = {
|
||||
fields: [{key:"due", parser:"date"},
|
||||
{key:"account"},
|
||||
{key:"quantity", parser:"number"},
|
||||
{key:"amount", parser:parseNumberFromCurrency} // point to a custom parser
|
||||
]
|
||||
};
|
||||
|
||||
var myDataTable = new YAHOO.widget.DataTable("markup", myColumnDefs, myDataSource,
|
||||
{caption:"Example: Progressively Enhanced Table from Markup",
|
||||
sortedBy:{key:"due",dir:"desc"}}
|
||||
);
|
||||
|
||||
return {
|
||||
oDS: myDataSource,
|
||||
oDT: myDataTable
|
||||
};
|
||||
}();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
363
www/extras/yui/examples/datatable/dt_enhanced_log.html
Normal file
363
www/extras/yui/examples/datatable/dt_enhanced_log.html
Normal file
File diff suppressed because one or more lines are too long
322
www/extras/yui/examples/datatable/dt_fixedscroll.html
Normal file
322
www/extras/yui/examples/datatable/dt_fixedscroll.html
Normal file
File diff suppressed because one or more lines are too long
125
www/extras/yui/examples/datatable/dt_fixedscroll_clean.html
Normal file
125
www/extras/yui/examples/datatable/dt_fixedscroll_clean.html
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
<!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=utf-8">
|
||||
<title>XY-scrolling, Y-scrolling, and X-scrolling</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/button/assets/skins/sam/button.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/button/button-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-min.js"></script>
|
||||
|
||||
<!--there is no custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
|
||||
<h1>XY-scrolling, Y-scrolling, and X-scrolling</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>Scrolling can be enabled on a DataTable along the x, y, or xy-axes. Set the
|
||||
DataTable's "scrollable" value to "true", and set a width and/and or height string
|
||||
values.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<h2 class="first">XY Scrolling</h2>
|
||||
<div id="xyscrolling"></div>
|
||||
|
||||
<h2>Y Scrolling</h2>
|
||||
<div id="yscrolling"></div>
|
||||
|
||||
<h2>X Scrolling</h2>
|
||||
<div id="xscrolling"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.Scrolling = function() {
|
||||
var myColumnDefs = [
|
||||
{key:"field1", width:50},
|
||||
{key:"field2", width:100, formatter:"date"},
|
||||
{key:"field3", width:50},
|
||||
{key:"field4", width:50},
|
||||
{key:"field5", width:50},
|
||||
{key:"field6", width:150}
|
||||
];
|
||||
|
||||
var myColumnDefsY = [
|
||||
{key:"field1", width:50},
|
||||
{key:"field2", width:100, formatter:"date"},
|
||||
{key:"field3", width:50},
|
||||
{key:"field4", width:50},
|
||||
{key:"field5", width:50},
|
||||
{key:"field6", width:150}
|
||||
];
|
||||
|
||||
var myColumnDefsX = [
|
||||
{key:"field1", width:50},
|
||||
{key:"field2", width:100, formatter:"date"},
|
||||
{key:"field3", width:50},
|
||||
{key:"field4", width:50},
|
||||
{key:"field5", width:50},
|
||||
{key:"field6", width:150}
|
||||
];
|
||||
|
||||
var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.multitypes);
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
|
||||
myDataSource.responseSchema = {
|
||||
resultsList: "items",
|
||||
fields: [
|
||||
{key:"field1"},
|
||||
{key:"field2", formatter:"date"},
|
||||
{key:"field3"},
|
||||
{key:"field4"},
|
||||
{key:"field5"},
|
||||
{key:"field6"}
|
||||
]
|
||||
};
|
||||
|
||||
// Set "scrollable:true" and set width and height string values
|
||||
var myDataTableXY = new YAHOO.widget.DataTable("xyscrolling", myColumnDefs,
|
||||
myDataSource, {scrollable:true, width:"30em", height:"10em"});
|
||||
|
||||
// Set "scrollable:true" and set only height string value
|
||||
var myDataTableY = new YAHOO.widget.DataTable("yscrolling", myColumnDefsY,
|
||||
myDataSource, {scrollable:true, height:"10em"});
|
||||
|
||||
// Set "scrollable:true" and set only width string value
|
||||
var myDataTableX = new YAHOO.widget.DataTable("xscrolling", myColumnDefsX,
|
||||
myDataSource, {scrollable:true, width:"30em"});
|
||||
|
||||
return {
|
||||
oDS: myDataSource,
|
||||
oDTXY: myDataTableXY,
|
||||
oDTY: myDataTableY,
|
||||
oDTX: myDataTableX
|
||||
};
|
||||
}();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
326
www/extras/yui/examples/datatable/dt_fixedscroll_log.html
Normal file
326
www/extras/yui/examples/datatable/dt_fixedscroll_log.html
Normal file
File diff suppressed because one or more lines are too long
283
www/extras/yui/examples/datatable/dt_formatting.html
Normal file
283
www/extras/yui/examples/datatable/dt_formatting.html
Normal file
File diff suppressed because one or more lines are too long
285
www/extras/yui/examples/datatable/dt_formatting_log.html
Normal file
285
www/extras/yui/examples/datatable/dt_formatting_log.html
Normal file
File diff suppressed because one or more lines are too long
123
www/extras/yui/examples/datatable/dt_formatting_source.html
Normal file
123
www/extras/yui/examples/datatable/dt_formatting_source.html
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
.yui-skin-sam .yui-dt tbody td.up {
|
||||
background-color: #efe;
|
||||
}
|
||||
.yui-skin-sam .yui-dt tbody td.down {
|
||||
background-color: #fee;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="yui-skin-sam">
|
||||
<h1>Custom Cell Formatting</h1>
|
||||
<div id="formatting"></div>
|
||||
|
||||
<script type="text/javascript" src="../../build/yuiloader/yuiloader.js"></script>
|
||||
<script type="text/javascript" src="./assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
var loader = new YAHOO.util.YUILoader();
|
||||
loader.insert({
|
||||
require: ["fonts", "datatable", "json"],
|
||||
filter: 'debug',
|
||||
base: '../../build/',
|
||||
onSuccess: function() {
|
||||
YAHOO.example.CustomFormatting = function() {
|
||||
// Define a custom formatter for the Column labeled "flag"
|
||||
// draws an up icon and adds class "up" to the cell liner to affect
|
||||
// a green background color if value of field3 is greater than 100.
|
||||
// Otherwise renders a down icon and assigns class "down", setting
|
||||
// the background color to red.
|
||||
var myCustomFormatter = function(elCell, oRecord, oColumn, oData) {
|
||||
if(oRecord.getData("field3") > 100) {
|
||||
YAHOO.util.Dom.replaceClass(elCell.parentNode, "down", "up");
|
||||
elCell.innerHTML = ' <img src="../../build/datatable/assets/skins/sam/dt-arrow-up.png">';
|
||||
}
|
||||
else {
|
||||
YAHOO.util.Dom.replaceClass(elCell.parentNode, "up","down");
|
||||
elCell.innerHTML = ' <img src="../../build/datatable/assets/skins/sam/dt-arrow-dn.png">';
|
||||
}
|
||||
};
|
||||
|
||||
// Add the custom formatter to the shortcuts
|
||||
YAHOO.widget.DataTable.Formatter.myCustom = myCustomFormatter;
|
||||
|
||||
// Override the built-in formatter
|
||||
YAHOO.widget.DataTable.formatEmail = function(elCell, oRecord, oColumn, oData) {
|
||||
var user = oData;
|
||||
elCell.innerHTML = "<a href=\"mailto:" + user + "@mycompany.com\">" + user + "</a>";
|
||||
};
|
||||
|
||||
|
||||
var myColumnDefs = [
|
||||
{key:"flag", formatter:"myCustom"}, // use custom shortcut
|
||||
{key:"radio", formatter:"radio"}, // use the built-in radio formatter
|
||||
{key:"check", formatter:"checkbox"}, // use the built-in checkbox formatter (shortcut)
|
||||
{key:"button", label:"Show record data", formatter:YAHOO.widget.DataTable.formatButton}, // use the built-in button formatter
|
||||
{key:"field1", formatter:"dropdown", dropdownOptions:["apples","bananas","cherries"],sortable:true},
|
||||
{key:"field2", sortable:true, formatter:"date"}, // use the built-in date formatter
|
||||
{key:"field3", sortable:true, formatter:"number"},
|
||||
{key:"field4", sortable:true, formatter:"currency"}, // use the built-in currency formatter
|
||||
{key:"field5", sortable:true, formatter:YAHOO.widget.DataTable.formatEmail}, // use the overridden email formatter
|
||||
{key:"field6", sortable:true, formatter:YAHOO.widget.DataTable.formatLink} // use the built-in link formatter
|
||||
];
|
||||
|
||||
var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.multitypes);
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
|
||||
myDataSource.responseSchema = {
|
||||
resultsList: "items",
|
||||
// Use the parse methods to populate the RecordSet with the right data types
|
||||
fields: [
|
||||
{key:"field1", parser:"string"}, // point to the string parser
|
||||
{key:"field2", parser:"date"}, // point to the date parser
|
||||
{key:"field3", parser:"number"}, // point to the number parser
|
||||
{key:"field4", parser:"number"}, // point to the number parser
|
||||
{key:"field5"}, // this is already string data so no parser needed
|
||||
{key:"field6"} // this is already string data so no parser needed
|
||||
]
|
||||
};
|
||||
|
||||
var myDataTable = new YAHOO.widget.DataTable("formatting", myColumnDefs, myDataSource);
|
||||
|
||||
var lastSelectedRadioRecord = null;
|
||||
myDataTable.subscribe("radioClickEvent", function(oArgs){
|
||||
if(lastSelectedRadioRecord) {
|
||||
lastSelectedRadioRecord.setData("radio",false);
|
||||
}
|
||||
var elRadio = oArgs.target;
|
||||
var oRecord = this.getRecord(elRadio);
|
||||
oRecord.setData("radio",true);
|
||||
lastSelectedRadioRecord = oRecord;
|
||||
var name = oRecord.getData("field5");
|
||||
});
|
||||
|
||||
myDataTable.subscribe("checkboxClickEvent", function(oArgs){
|
||||
var elCheckbox = oArgs.target;
|
||||
var oRecord = this.getRecord(elCheckbox);
|
||||
oRecord.setData("check",elCheckbox.checked);
|
||||
});
|
||||
|
||||
myDataTable.subscribe("buttonClickEvent", function(oArgs){
|
||||
var oRecord = this.getRecord(oArgs.target);
|
||||
alert(YAHOO.lang.dump(oRecord.getData()));
|
||||
});
|
||||
|
||||
myDataTable.subscribe("dropdownChangeEvent", function(oArgs){
|
||||
var elDropdown = oArgs.target;
|
||||
var oRecord = this.getRecord(elDropdown);
|
||||
oRecord.setData("field1",elDropdown.options[elDropdown.selectedIndex].value);
|
||||
});
|
||||
|
||||
return {
|
||||
oDS: myDataSource,
|
||||
oDT: myDataTable
|
||||
};
|
||||
}();
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
278
www/extras/yui/examples/datatable/dt_highlighting.html
Normal file
278
www/extras/yui/examples/datatable/dt_highlighting.html
Normal file
File diff suppressed because one or more lines are too long
105
www/extras/yui/examples/datatable/dt_highlighting_clean.html
Normal file
105
www/extras/yui/examples/datatable/dt_highlighting_clean.html
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
<!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=utf-8">
|
||||
<title>Highlighting Cells, Rows, or Columns</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/button/assets/skins/sam/button.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/container/assets/skins/sam/container.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/button/button-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/container/container-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-min.js"></script>
|
||||
|
||||
<!--there is no custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
|
||||
<h1>Highlighting Cells, Rows, or Columns</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p></p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="cell"></div>
|
||||
<div id="row"></div>
|
||||
<div id="column"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.Highlighting = function() {
|
||||
var myColumnDefs = [
|
||||
{key:"Page"},
|
||||
{key:"VisitsThisMonth"},
|
||||
{key:"VisitsThisYear"},
|
||||
{key:"ViewsThisMonth"},
|
||||
{key:"ViewsThisYear"}
|
||||
];
|
||||
|
||||
var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.webstats);
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
myDataSource.responseSchema = {
|
||||
fields: ["Page","VisitsThisMonth","VisitsThisYear","ViewsThisMonth","ViewsThisYear"]
|
||||
};
|
||||
|
||||
var cellHighlightDataTable = new YAHOO.widget.DataTable("cell",
|
||||
myColumnDefs, myDataSource, {
|
||||
caption:"Example: Cell Highlighting"
|
||||
});
|
||||
// Enable cell highlighting
|
||||
cellHighlightDataTable.subscribe("cellMouseoverEvent", cellHighlightDataTable.onEventHighlightCell);
|
||||
cellHighlightDataTable.subscribe("cellMouseoutEvent", cellHighlightDataTable.onEventUnhighlightCell);
|
||||
|
||||
var rowHighlightDataTable = new YAHOO.widget.DataTable("row",
|
||||
myColumnDefs, myDataSource, {
|
||||
caption:"Example: Row Highlighting"
|
||||
});
|
||||
// Enable row highlighting
|
||||
rowHighlightDataTable.subscribe("rowMouseoverEvent", rowHighlightDataTable.onEventHighlightRow);
|
||||
rowHighlightDataTable.subscribe("rowMouseoutEvent", rowHighlightDataTable.onEventUnhighlightRow);
|
||||
|
||||
var colHighlightDataTable = new YAHOO.widget.DataTable("column",
|
||||
myColumnDefs, myDataSource, {
|
||||
caption:"Example: Column Highlighting"
|
||||
});
|
||||
// Enable Column highlighting
|
||||
colHighlightDataTable.subscribe("theadCellMouseoverEvent", colHighlightDataTable.onEventHighlightColumn);
|
||||
colHighlightDataTable.subscribe("theadCellMouseoutEvent", colHighlightDataTable.onEventUnhighlightColumn);
|
||||
|
||||
return {
|
||||
oDS: myDataSource,
|
||||
oDTCellHighlight: cellHighlightDataTable,
|
||||
oDTRowHighlight: rowHighlightDataTable,
|
||||
oDTColHighlight: colHighlightDataTable
|
||||
};
|
||||
}();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
282
www/extras/yui/examples/datatable/dt_highlighting_log.html
Normal file
282
www/extras/yui/examples/datatable/dt_highlighting_log.html
Normal file
File diff suppressed because one or more lines are too long
251
www/extras/yui/examples/datatable/dt_nestedheaders.html
Normal file
251
www/extras/yui/examples/datatable/dt_nestedheaders.html
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,87 @@
|
|||
<!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=utf-8">
|
||||
<title>Nested Headers</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/dragdrop/dragdrop-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-min.js"></script>
|
||||
|
||||
<!--there is no custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
|
||||
<h1>Nested Headers</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p></p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="nested"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.NestedHeaders = function() {
|
||||
var myColumnDefs = [
|
||||
{key:"page", label:"Page", sortable:true, resizeable:true},
|
||||
{label:"Statistics", formatter:YAHOO.widget.DataTable.formatNumber, children:[
|
||||
{label:"Visits",
|
||||
children: [
|
||||
{key:"visitsmonth", label:"This Month",sortable:true, resizeable:true},
|
||||
{key:"visitsytd", label:"YTD", abbr:"Year to Date",sortable:true, resizeable:true}
|
||||
]
|
||||
},
|
||||
{label:"Views",
|
||||
children: [
|
||||
{key:"viewsmonth", label:"This Month",sortable:true, resizeable:true},
|
||||
{key:"viewsytd", label:"YTD", abbr:"Year to Date",sortable:true, resizeable:true}
|
||||
]
|
||||
|
||||
}
|
||||
]}
|
||||
];
|
||||
|
||||
var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.webstats);
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
myDataSource.responseSchema = {
|
||||
fields: ["page","visitsmonth","visitsytd","viewsmonth","viewsytd"]
|
||||
};
|
||||
|
||||
var myDataTable = new YAHOO.widget.DataTable("nested", myColumnDefs, myDataSource);
|
||||
|
||||
return {
|
||||
oDS: myDataSource,
|
||||
oDT: myDataTable
|
||||
};
|
||||
}();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
255
www/extras/yui/examples/datatable/dt_nestedheaders_log.html
Normal file
255
www/extras/yui/examples/datatable/dt_nestedheaders_log.html
Normal file
File diff suppressed because one or more lines are too long
307
www/extras/yui/examples/datatable/dt_row_coloring.html
Normal file
307
www/extras/yui/examples/datatable/dt_row_coloring.html
Normal file
File diff suppressed because one or more lines are too long
121
www/extras/yui/examples/datatable/dt_row_coloring_clean.html
Normal file
121
www/extras/yui/examples/datatable/dt_row_coloring_clean.html
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
<!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=utf-8">
|
||||
<title>Conditional row coloring</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
<style type="text/css">
|
||||
|
||||
/* Remove row striping, column borders, and sort highlighting */
|
||||
.yui-skin-sam tr.yui-dt-odd,
|
||||
.yui-skin-sam tr.yui-dt-odd td.yui-dt-asc,
|
||||
.yui-skin-sam tr.yui-dt-odd td.yui-dt-desc,
|
||||
.yui-skin-sam tr.yui-dt-even td.yui-dt-asc,
|
||||
.yui-skin-sam tr.yui-dt-even td.yui-dt-desc {
|
||||
background-color: #fff;
|
||||
}
|
||||
.yui-skin-sam .yui-dt tbody td {
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
.yui-skin-sam .yui-dt thead th {
|
||||
border-bottom: 1px solid #7f7f7f;
|
||||
}
|
||||
.yui-skin-sam .yui-dt tr.yui-dt-last td,
|
||||
.yui-skin-sam .yui-dt th,
|
||||
.yui-skin-sam .yui-dt td {
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* Class for marked rows */
|
||||
.yui-skin-sam .yui-dt tr.mark,
|
||||
.yui-skin-sam .yui-dt tr.mark td.yui-dt-asc,
|
||||
.yui-skin-sam .yui-dt tr.mark td.yui-dt-desc,
|
||||
.yui-skin-sam .yui-dt tr.mark td.yui-dt-asc,
|
||||
.yui-skin-sam .yui-dt tr.mark td.yui-dt-desc {
|
||||
background-color: #a33;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
|
||||
<h1>Conditional row coloring</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>This example demonstrates how to color DataTable rows based on data in a Record. In this case, rows with Quantity less than 40 are highlighted.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div class="demo">
|
||||
<div id="tbl"></div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.onDOMReady(function () {
|
||||
|
||||
// Create a shortcut
|
||||
var Dom = YAHOO.util.Dom;
|
||||
|
||||
// Contain our code under the YAHOO.example namespace
|
||||
var Ex = YAHOO.example;
|
||||
|
||||
// Create the DataSource
|
||||
Ex.dataSource = new YAHOO.util.DataSource(Ex.Data.inventory);
|
||||
Ex.dataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
Ex.dataSource.responseSchema = {
|
||||
fields : ['SKU','Quantity','Item','Description']
|
||||
};
|
||||
|
||||
// Define a custom row formatter function
|
||||
var myRowFormatter = function(elTr, oRecord) {
|
||||
if (oRecord.getData('Quantity') < 40) {
|
||||
Dom.addClass(elTr, 'mark');
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
// Instantiate the DataTable.
|
||||
Ex.dataTable = new YAHOO.widget.DataTable('tbl',
|
||||
[ {key:'SKU',sortable: true},
|
||||
{key:'Item',sortable: true},
|
||||
{key:'Quantity',sortable: true},
|
||||
{key:'Description',sortable: true}
|
||||
],
|
||||
Ex.dataSource,
|
||||
{formatRow: myRowFormatter}); // Enable the row formatter
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
311
www/extras/yui/examples/datatable/dt_row_coloring_log.html
Normal file
311
www/extras/yui/examples/datatable/dt_row_coloring_log.html
Normal file
File diff suppressed because one or more lines are too long
387
www/extras/yui/examples/datatable/dt_rowadddelete.html
Normal file
387
www/extras/yui/examples/datatable/dt_rowadddelete.html
Normal file
File diff suppressed because one or more lines are too long
166
www/extras/yui/examples/datatable/dt_rowadddelete_clean.html
Normal file
166
www/extras/yui/examples/datatable/dt_rowadddelete_clean.html
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
<!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=utf-8">
|
||||
<title>Adding and Deleting Rows</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/button/assets/skins/sam/button.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/button/button-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/dragdrop/dragdrop-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
<style type="text/css">
|
||||
/* custom styles for this example */
|
||||
#buttons {margin-bottom: 1em;}
|
||||
</style>
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
|
||||
<h1>Adding and Deleting Rows</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>Adding and deleting rows dynamically.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="buttons">
|
||||
<span id="addrow" class="yui-button yui-push-button">
|
||||
<span class="first-child">
|
||||
<button type="button">Add one row</button>
|
||||
</span>
|
||||
</span>
|
||||
<span id="deleterow" class="yui-button yui-push-button">
|
||||
<span class="first-child">
|
||||
<button type="button">Delete top row</button>
|
||||
</span>
|
||||
</span>
|
||||
<span id="addrows" class="yui-button yui-push-button">
|
||||
<span class="first-child">
|
||||
<button type="button">Add 20 rows</button>
|
||||
</span>
|
||||
</span>
|
||||
<span id="deleterows" class="yui-button yui-push-button">
|
||||
<span class="first-child">
|
||||
<button type="button" name="button5">Delete top 20 rows</button>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div id="basic"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.DynamicData = function() {
|
||||
var data = {one:"one",two:"two",three:"three"};
|
||||
|
||||
var myColumnDefs = [
|
||||
{key:"row",resizeable:true,sortable:true},
|
||||
{key:"one",resizeable:true},
|
||||
{key:"two",resizeable:true},
|
||||
{key:"three",resizeable:true}
|
||||
];
|
||||
|
||||
var myDataSource = new YAHOO.util.DataSource([]);
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
myDataSource.responseSchema = {
|
||||
fields: ["one","two","three"]
|
||||
};
|
||||
|
||||
var myDataTable = new YAHOO.widget.DataTable("basic",
|
||||
myColumnDefs, myDataSource, {});
|
||||
|
||||
var i=1,
|
||||
bReverseSorted = false;
|
||||
|
||||
// Track when Column is reverse-sorted, since new data will come in out of order
|
||||
var trackReverseSorts = function(oArg) {
|
||||
bReverseSorted = (oArg.dir === YAHOO.widget.DataTable.CLASS_DESC);
|
||||
};
|
||||
myDataTable.subscribe("columnSortEvent", trackReverseSorts);
|
||||
|
||||
// Add one row to the bottom
|
||||
var btnAddRow = new YAHOO.widget.Button("addrow");
|
||||
btnAddRow.on("click", function() {
|
||||
// Clear sort when necessary
|
||||
if(bReverseSorted) {
|
||||
myDataTable.set("sortedBy", null);
|
||||
}
|
||||
|
||||
var record = YAHOO.widget.DataTable._cloneObject(data);
|
||||
record.row = i++;
|
||||
myDataTable.addRow(record);
|
||||
},this,true);
|
||||
|
||||
// Add 20 rows to the bottom
|
||||
var btnAddRows = new YAHOO.widget.Button("addrows");
|
||||
btnAddRows.on("click", function(e) {
|
||||
// Clear sort when necessary
|
||||
if(bReverseSorted) {
|
||||
myDataTable.set("sortedBy", null);
|
||||
}
|
||||
|
||||
var myArray = [];
|
||||
for(var l=i;i<=l+19;i++) {
|
||||
var record = YAHOO.widget.DataTable._cloneObject(data);
|
||||
record.row = i;
|
||||
myArray.push(record);
|
||||
}
|
||||
myDataTable.addRows(myArray);
|
||||
},this,true);
|
||||
|
||||
// Delete one row from the top
|
||||
var btnDeleteRow = new YAHOO.widget.Button("deleterow");
|
||||
btnDeleteRow.on("click", function() {
|
||||
if(myDataTable.getRecordSet().getLength() > 0) {
|
||||
myDataTable.deleteRow(0);
|
||||
}
|
||||
},this,true);
|
||||
|
||||
// Delete 20 row from the top
|
||||
var btnDeleteRows = new YAHOO.widget.Button("deleterows");
|
||||
btnDeleteRows.on("click", function() {
|
||||
var length = myDataTable.getRecordSet().getLength();
|
||||
if(length > 0) {
|
||||
var count = (length > 19) ? 20 : length;
|
||||
myDataTable.deleteRows(0,count);
|
||||
}
|
||||
},this,true);
|
||||
|
||||
return {
|
||||
oDS: myDataSource,
|
||||
oDT: myDataTable
|
||||
};
|
||||
}();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
391
www/extras/yui/examples/datatable/dt_rowadddelete_log.html
Normal file
391
www/extras/yui/examples/datatable/dt_rowadddelete_log.html
Normal file
File diff suppressed because one or more lines are too long
301
www/extras/yui/examples/datatable/dt_rowselect.html
Normal file
301
www/extras/yui/examples/datatable/dt_rowselect.html
Normal file
File diff suppressed because one or more lines are too long
113
www/extras/yui/examples/datatable/dt_rowselect_clean.html
Normal file
113
www/extras/yui/examples/datatable/dt_rowselect_clean.html
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
<!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=utf-8">
|
||||
<title>Row Selection</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
<style type="text/css">
|
||||
/* custom styles for this example */
|
||||
.yui-skin-sam .yui-dt-body { cursor:pointer; } /* when rows are selectable */
|
||||
#single { margin-top:2em; }
|
||||
</style>
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
|
||||
<h1>Row Selection</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>These examples demonstrate "standard" row selection mode and "single" row
|
||||
selection mode.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="standard"></div>
|
||||
<div id="single"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.RowSelection = function() {
|
||||
var myColumnDefs = [
|
||||
{key:"Date",formatter:YAHOO.widget.DataTable.formatDate, sortable:true},
|
||||
{key:"To", sortable:true},
|
||||
{key:"From", sortable:true},
|
||||
{key:"Subject", sortable:true}
|
||||
];
|
||||
|
||||
var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.emails);
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
|
||||
myDataSource.responseSchema = {
|
||||
resultsList: "messages",
|
||||
fields: ["Date","To","From","Subject","XID","Date","Attachment"]
|
||||
};
|
||||
|
||||
var standardSelectDataTable = new YAHOO.widget.DataTable("standard",
|
||||
myColumnDefs, myDataSource, {
|
||||
caption:"Standard Row Selection with Support for Modifier Keys"
|
||||
});
|
||||
|
||||
// Subscribe to events for row selection
|
||||
standardSelectDataTable.subscribe("rowMouseoverEvent", standardSelectDataTable.onEventHighlightRow);
|
||||
standardSelectDataTable.subscribe("rowMouseoutEvent", standardSelectDataTable.onEventUnhighlightRow);
|
||||
standardSelectDataTable.subscribe("rowClickEvent", standardSelectDataTable.onEventSelectRow);
|
||||
|
||||
// Programmatically select the first row
|
||||
standardSelectDataTable.selectRow(standardSelectDataTable.getTrEl(0));
|
||||
// Programmatically bring focus to the instance so arrow selection works immediately
|
||||
standardSelectDataTable.focus();
|
||||
|
||||
var singleSelectDataTable = new YAHOO.widget.DataTable("single",
|
||||
myColumnDefs, myDataSource, {
|
||||
caption:"Single-Row Selection with Modifier Keys Disabled",
|
||||
selectionMode:"single"
|
||||
});
|
||||
|
||||
// Subscribe to events for row selection
|
||||
singleSelectDataTable.subscribe("rowMouseoverEvent", singleSelectDataTable.onEventHighlightRow);
|
||||
singleSelectDataTable.subscribe("rowMouseoutEvent", singleSelectDataTable.onEventUnhighlightRow);
|
||||
singleSelectDataTable.subscribe("rowClickEvent", singleSelectDataTable.onEventSelectRow);
|
||||
|
||||
// Programmatically select the first row
|
||||
singleSelectDataTable.selectRow(singleSelectDataTable.getTrEl(0));
|
||||
|
||||
return {
|
||||
oDS: myDataSource,
|
||||
oDTStandardSelect: standardSelectDataTable,
|
||||
oDTSingleSelect: singleSelectDataTable
|
||||
};
|
||||
}();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
305
www/extras/yui/examples/datatable/dt_rowselect_log.html
Normal file
305
www/extras/yui/examples/datatable/dt_rowselect_log.html
Normal file
File diff suppressed because one or more lines are too long
644
www/extras/yui/examples/datatable/dt_skinning.html
Normal file
644
www/extras/yui/examples/datatable/dt_skinning.html
Normal file
File diff suppressed because one or more lines are too long
302
www/extras/yui/examples/datatable/dt_xhrjson.html
Normal file
302
www/extras/yui/examples/datatable/dt_xhrjson.html
Normal file
File diff suppressed because one or more lines are too long
104
www/extras/yui/examples/datatable/dt_xhrjson_clean.html
Normal file
104
www/extras/yui/examples/datatable/dt_xhrjson_clean.html
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
<!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=utf-8">
|
||||
<title>JSON Data Over XHR</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/connection/connection-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/json/json-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-min.js"></script>
|
||||
|
||||
<!--there is no custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
|
||||
<h1>JSON Data Over XHR</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>This example populates a DataTable with data received via XHR from the Yahoo!
|
||||
Local webservice.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="json"></div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.XHR_JSON = function() {
|
||||
var formatUrl = function(elCell, oRecord, oColumn, sData) {
|
||||
elCell.innerHTML = "<a href='" + oRecord.getData("ClickUrl") + "' target='_blank'>" + sData + "</a>";
|
||||
};
|
||||
|
||||
var myColumnDefs = [
|
||||
{key:"Title", label:"Name", sortable:true, formatter:formatUrl},
|
||||
{key:"Phone"},
|
||||
{key:"City"},
|
||||
{key:"Rating.AverageRating", label:"Rating", formatter:YAHOO.widget.DataTable.formatNumber, sortable:true}
|
||||
];
|
||||
|
||||
var myDataSource = new YAHOO.util.DataSource("assets/php/ylocal_proxy.php?");
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
|
||||
myDataSource.connXhrMode = "queueRequests";
|
||||
myDataSource.responseSchema = {
|
||||
resultsList: "ResultSet.Result",
|
||||
fields: ["Title","Phone","City",{key:"Rating.AverageRating",parser:"number"},"ClickUrl"]
|
||||
};
|
||||
|
||||
var myDataTable = new YAHOO.widget.DataTable("json", myColumnDefs,
|
||||
myDataSource, {initialRequest:"query=pizza&zip=94089&results=10&output=json"});
|
||||
|
||||
var mySuccessHandler = function() {
|
||||
this.set("sortedBy", null);
|
||||
this.onDataReturnAppendRows.apply(this,arguments);
|
||||
};
|
||||
var myFailureHandler = function() {
|
||||
this.showTableMessage(YAHOO.widget.DataTable.MSG_ERROR, YAHOO.widget.DataTable.CLASS_ERROR);
|
||||
this.onDataReturnAppendRows.apply(this,arguments);
|
||||
};
|
||||
var callbackObj = {
|
||||
success : mySuccessHandler,
|
||||
failure : myFailureHandler,
|
||||
scope : myDataTable
|
||||
};
|
||||
|
||||
myDataSource.sendRequest("query=mexican&zip=94089&results=10&output=json",
|
||||
callbackObj);
|
||||
|
||||
myDataSource.sendRequest("query=chinese&zip=94089&results=10&output=json",
|
||||
callbackObj);
|
||||
|
||||
return {
|
||||
oDS: myDataSource,
|
||||
oDT: myDataTable
|
||||
};
|
||||
}();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
306
www/extras/yui/examples/datatable/dt_xhrjson_log.html
Normal file
306
www/extras/yui/examples/datatable/dt_xhrjson_log.html
Normal file
File diff suppressed because one or more lines are too long
283
www/extras/yui/examples/datatable/dt_xhrlocalxml.html
Normal file
283
www/extras/yui/examples/datatable/dt_xhrlocalxml.html
Normal file
File diff suppressed because one or more lines are too long
92
www/extras/yui/examples/datatable/dt_xhrlocalxml_clean.html
Normal file
92
www/extras/yui/examples/datatable/dt_xhrlocalxml_clean.html
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
<!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=utf-8">
|
||||
<title>Local XML Data</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/connection/connection-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-min.js"></script>
|
||||
|
||||
<!--there is no custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
|
||||
<h1>Local XML Data</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>This DataTable is populated with XML data from a webservice that is held in local memory in the
|
||||
JavaScript variable xmlDoc.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="localxml"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.Local_XML = function() {
|
||||
var myDataSource, myDataTable;
|
||||
|
||||
var connectionCallback = {
|
||||
success: function(o) {
|
||||
var xmlDoc = o.responseXML;
|
||||
|
||||
var myColumnDefs = [
|
||||
{key:"Title", label:"Name", sortable:true, formatter:"link"},
|
||||
{key:"Phone"},
|
||||
{key:"City"},
|
||||
{key:"AverageRating", label:"Rating",formatter:YAHOO.widget.DataTable.formatNumber, sortable:true}
|
||||
];
|
||||
|
||||
myDataSource = new YAHOO.util.DataSource(xmlDoc);
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_XML;
|
||||
myDataSource.responseSchema = {
|
||||
resultNode: "Result",
|
||||
fields: ["Title","Phone","City",{key:"AverageRating",parser:"number"},"ClickUrl"]
|
||||
};
|
||||
|
||||
myDataTable = new YAHOO.widget.DataTable("localxml", myColumnDefs, myDataSource);
|
||||
|
||||
},
|
||||
failure: function(o) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
var getXML = YAHOO.util.Connect.asyncRequest("GET",
|
||||
"assets/php/ylocal_proxy.php?query=pizza&zip=94089&results=10",
|
||||
connectionCallback);
|
||||
|
||||
return {
|
||||
oDS: myDataSource,
|
||||
oDT: myDataTable
|
||||
};
|
||||
}();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
287
www/extras/yui/examples/datatable/dt_xhrlocalxml_log.html
Normal file
287
www/extras/yui/examples/datatable/dt_xhrlocalxml_log.html
Normal file
File diff suppressed because one or more lines are too long
258
www/extras/yui/examples/datatable/dt_xhrpostxml.html
Normal file
258
www/extras/yui/examples/datatable/dt_xhrpostxml.html
Normal file
File diff suppressed because one or more lines are too long
82
www/extras/yui/examples/datatable/dt_xhrpostxml_clean.html
Normal file
82
www/extras/yui/examples/datatable/dt_xhrpostxml_clean.html
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
<!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=utf-8">
|
||||
<title>XML Data Over XHR With POST</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/connection/connection-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-min.js"></script>
|
||||
|
||||
<!--there is no custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
|
||||
<h1>XML Data Over XHR With POST</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>This examples makes a POST query to the Yahoo! Local webservice to populate
|
||||
a DataTable.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="xml"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.XHR_XML = function() {
|
||||
var formatUrl = function(elCell, oRecord, oColumn, sData) {
|
||||
elCell.innerHTML = "<a href='" + oRecord.getData("ClickUrl") + "' target='_blank'>" + sData + "</a>";
|
||||
};
|
||||
|
||||
var myColumnDefs = [
|
||||
{key:"Title", label:"Name", sortable:true, formatter:formatUrl},
|
||||
{key:"Phone"},
|
||||
{key:"City"},
|
||||
{key:"AverageRating", label:"Rating",formatter:YAHOO.widget.DataTable.formatNumber, sortable:true}
|
||||
];
|
||||
|
||||
var myDataSource = new YAHOO.util.DataSource("assets/php/ylocal_proxy.php?");
|
||||
myDataSource.connMethodPost = true;
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_XML;
|
||||
myDataSource.responseSchema = {
|
||||
resultNode: "Result",
|
||||
fields: ["Title","Phone","City",{key:"AverageRating",parser:"number"},"ClickUrl"]
|
||||
};
|
||||
|
||||
var myDataTable = new YAHOO.widget.DataTable("xml", myColumnDefs,
|
||||
myDataSource, {initialRequest:"query=pizza&zip=94089&results=10"});
|
||||
|
||||
return {
|
||||
oDS: myDataSource,
|
||||
oDT: myDataTable
|
||||
};
|
||||
}();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
262
www/extras/yui/examples/datatable/dt_xhrpostxml_log.html
Normal file
262
www/extras/yui/examples/datatable/dt_xhrpostxml_log.html
Normal file
File diff suppressed because one or more lines are too long
313
www/extras/yui/examples/datatable/dt_xhrtext.html
Normal file
313
www/extras/yui/examples/datatable/dt_xhrtext.html
Normal file
File diff suppressed because one or more lines are too long
122
www/extras/yui/examples/datatable/dt_xhrtext_clean.html
Normal file
122
www/extras/yui/examples/datatable/dt_xhrtext_clean.html
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
<!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=utf-8">
|
||||
<title>Textual Data Over XHR</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/connection/connection-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
<style type="text/css">
|
||||
/* custom styles for this example */
|
||||
#textWithHeaderData {margin-top:2em;}
|
||||
</style>
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
|
||||
<h1>Textual Data Over XHR</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>This example demonstrates how to populate a DataTable with delimited text
|
||||
data over XHR. In the second instance, the data includes header data as the first
|
||||
row, which is parsed out with a custom implementation of the DataSource method
|
||||
doBeforeCallback().</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="text"></div>
|
||||
<div id="textWithHeaderData"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.XHR_Text = function() {
|
||||
var formatUrl = function(elCell, oRecord, oColumn, sData) {
|
||||
elCell.innerHTML = "<a href='" + oRecord.getData("Url") + "' target='_blank'>" + sData + "</a>";
|
||||
};
|
||||
|
||||
var myColumnDefs = [
|
||||
{key:"Name", sortable:true, formatter:formatUrl},
|
||||
{key:"Phone"},
|
||||
{key:"City"},
|
||||
{key:"Rating", formatter:YAHOO.widget.DataTable.formatNumber, sortable:true}
|
||||
|
||||
];
|
||||
|
||||
var myDataSource = new YAHOO.util.DataSource("assets/php/text_proxy.txt");
|
||||
//myDataSource.responseType = YAHOO.util.DataSource.TYPE_TEXT;
|
||||
myDataSource.responseSchema = {
|
||||
recordDelim: "\n",
|
||||
fieldDelim: "|",
|
||||
fields: ["Name","Address","City","Phone",{key:"Rating",parser:"number"},"Url"]
|
||||
};
|
||||
|
||||
var myDataTable = new YAHOO.widget.DataTable("text", myColumnDefs,
|
||||
myDataSource, {caption:"Example: Textual Data Over XHR"});
|
||||
|
||||
|
||||
|
||||
var moreColumnDefs = [
|
||||
{key:"Restaurant", sortable:true, formatter:formatUrl},
|
||||
{key:"Location"},
|
||||
{key:"Town"},
|
||||
{key:"Stars", formatter:YAHOO.widget.DataTable.formatNumber, sortable:true}
|
||||
];
|
||||
|
||||
var anotherDataSource = new YAHOO.util.DataSource("assets/php/text_with_headers_proxy.txt");
|
||||
anotherDataSource.responseType = YAHOO.util.DataSource.TYPE_TEXT;
|
||||
anotherDataSource.responseSchema = {
|
||||
recordDelim: "\n",
|
||||
fieldDelim: "|",
|
||||
fields: ["Restaurant","Location","Town","Telephone",{key:"Stars",parser:"number"},"Url"]
|
||||
};
|
||||
// Upgrade note: As of 2.5.0, the second argument is the full type-converted
|
||||
// response from the live data, and not the unconverted raw response
|
||||
anotherDataSource.doBeforeCallback = function(oRequest, oFullResponse, oParsedResponse) {
|
||||
// Remove the first result (i.e., the headers);
|
||||
oParsedResponse.results.shift();
|
||||
return oParsedResponse;
|
||||
};
|
||||
|
||||
anotherDataTable = new YAHOO.widget.DataTable("textWithHeaderData", moreColumnDefs,
|
||||
anotherDataSource, {caption:"Example: First Record Holds Header Data"});
|
||||
|
||||
return {
|
||||
oDS: myDataSource,
|
||||
oDT: myDataTable,
|
||||
oDS2: anotherDataSource,
|
||||
oDT2: anotherDataTable
|
||||
};
|
||||
}();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
317
www/extras/yui/examples/datatable/dt_xhrtext_log.html
Normal file
317
www/extras/yui/examples/datatable/dt_xhrtext_log.html
Normal file
File diff suppressed because one or more lines are too long
95
www/extras/yui/examples/datatable/index.html
Normal file
95
www/extras/yui/examples/datatable/index.html
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue