-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
247 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Riot Grid</title> | ||
</head> | ||
<body> | ||
|
||
<script type="riot/tag"> | ||
<sample> | ||
<grid data="{collection}" tabindex="1" height="{300}" click="{handleSelect}" onchange="{handleSelect}" dblclick="{handleDoubleClick}"> | ||
<gridhead> | ||
<span style="width:70%">Name</span> | ||
<span style="width:30%">Age</span> | ||
</gridhead> | ||
|
||
<gridbody> | ||
<span style="width:70%">{row.name}</span> | ||
<span style="width:30%">{row.age}</span> | ||
</gridbody> | ||
</grid> | ||
<div style="background:#aaa;padding:10px;margin:2px 0;"> | ||
{collection.length} Rows | ||
</div> | ||
<p if="{sel.name}">You have selected {sel.name}</p> | ||
var self = this | ||
this.handleSelect = function(row){ | ||
self.update({sel:row}) | ||
} | ||
this.handleDoubleClick = function(row){ | ||
self.update({sel:row}) | ||
console.log(row,'double clicked') | ||
} | ||
</sample> | ||
|
||
</script> | ||
|
||
<sample></sample> | ||
|
||
|
||
<script src="../node_modules/riot/riot+compiler.min.js"></script> | ||
<script src="../lib/grid.js"></script> | ||
<script> | ||
var randAge = function() { return Math.round(Math.random() * 110) + 1;}; | ||
var randFirstname = function() { | ||
var names = ["Chloe", "Emily", "Megan", "Charlotte", "Jessica", "Lauren", "Sophie", "Olivia", "Hannah", "Lucy", "Georgia", "Rebecca", "Bethany", "Amy", "Ellie", "Katie", "Emma", "Abigail", "Molly", "Grace", "Courtney", "Shannon", "Caitlin", "Eleanor", "Jade", "Ella", "Leah", "Alice", "Holly", "Laura", "Anna", "Jasmine", "Sarah", "Elizabeth", "Amelia", "Rachel", "Amber", "Phoebe", "Natasha", "Niamh", "Zoe", "Paige", "Nicole", "Abbie", "Mia", "Imogen", "Lily", "Alexandra", "Chelsea", "Daisy", "Jack", "Thomas", "James", "Joshua", "Daniel", "Harry", "Samuel", "Joseph", "Matthew", "Callum", "Luke", "William", "Lewis", "Oliver", "Ryan", "Benjamin", "George", "Liam", "Jordan", "Adam", "Alexander", "Jake", "Connor", "Cameron", "Nathan", "Kieran", "Mohammed", "Jamie", "Jacob", "Michael", "Ben", "Ethan", "Charlie", "Bradley", "Brandon", "Aaron", "Max", "Dylan", "Kyle", "Robert", "Christopher", "David", "Edward", "Charles", "Owen", "Louis", "Alex", "Joe", "Rhyce"]; | ||
return names[Math.round(Math.random() * (names.length - 1))]; | ||
}; | ||
var randSurname = function() { | ||
var names = ["Smith", "Jones", "Taylor", "Williams", "Brown", "Davies", "Evans", "Wilson", "Thomas", "Roberts", "Johnson", "Lewis", "Walker", "Robinson", "Wood", "Thompson", "White", "Watson", "Jackson", "Wright", "Green", "Harris", "Cooper", "King", "Lee", "Martin", "Clarke", "James", "Morgan", "Hughes", "Edwards", "Hill", "Moore", "Clark", "Harrison", "Scott", "Young", "Morris", "Hall", "Ward", "Turner", "Carter", "Phillips", "Mitchell", "Patel", "Adams", "Campbell", "Anderson", "Allen", "Cook", "Bailey", "Parker", "Miller", "Davis", "Murphy", "Price", "Bell", "Baker", "Griffiths", "Kelly", "Simpson", "Marshall", "Collins", "Bennett", "Cox", "Richardson", "Fox", "Gray", "Rose", "Chapman", "Hunt", "Robertson", "Shaw", "Reynolds", "Lloyd", "Ellis", "Richards", "Russell", "Wilkinson", "Khan", "Graham", "Stewart", "Reid", "Murray", "Powell", "Palmer", "Holmes", "Rogers", "Stevens", "Walsh", "Hunter", "Thomson", "Matthews", "Ross", "Owen", "Mason", "Knight", "Kennedy", "Butler", "Saunders"]; | ||
return names[Math.round(Math.random() * (names.length - 1))]; | ||
}; | ||
var collection=[] | ||
var count=0 | ||
while(count<100000){ | ||
collection.push({id:count,name:randFirstname()+" "+randSurname(),age:randAge()}) | ||
count++; | ||
} | ||
riot.mount('sample',{collection:collection}) | ||
|
||
</script> | ||
|
||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters