Advertisement
Guest User

Untitled

a guest
Apr 15th, 2014
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. var initialData = [
  2. { id: 1, name: "Well-Travelled Kitten", sales: 352, price: 75.95 },
  3. { id: 2, name: "Speedy Coyote", sales: 89, price: 190.00 },
  4. { id: 3, name: "Furious Lizard", sales: 152, price: 25.00 },
  5. { id: 4, name: "Indifferent Monkey", sales: 1, price: 99.95 },
  6. { id: 5, name: "Brooding Dragon", sales: 0, price: 6350 },
  7. { id: 6, name: "Ingenious Tadpole", sales: 39450, price: 0.35 },
  8. { id: 7, name: "Optimistic Snail", sales: 420, price: 1.50 }
  9. ];
  10.  
  11. var ctor = function () {
  12.  
  13. this.animals = ko.observableArray([]);
  14. this.disabled = ko.observable(false);
  15.  
  16. this.activate = function () {
  17. this.animals(initialData);
  18. return true;
  19. }
  20. };
  21.  
  22. //Note: This module exports a function. That means that you, the developer, can create multiple instances.
  23. //This pattern is also recognized by Durandal so that it can create instances on demand.
  24.  
  25. return ctor;
  26.  
  27. <h3>Customers</h3>
  28.  
  29. <table id="animals" data-bind="grid: { data: animals }" >
  30. <caption>Amazing Animals</caption>
  31. <thead>
  32. <tr>
  33. <th data-field="actions" style="width:27px;"></th>
  34. <th data-field="name" width="150px">Item Name</th>
  35. <th data-field="sales">Sales Count</th>
  36. <th data-field="price">Price</th>
  37. </tr>
  38. </thead>
  39. <tbody>
  40. <tr>
  41. <td data-field="actions">
  42. <a class="grid-edit" data-bind="attr: { href: 'animals/' + id, title: name }, text: id"></a>
  43. </td>
  44. </tr>
  45. </tbody>
  46. </table>
  47.  
  48. <tbody data-bind='foreach:animals'>
  49. <tr>
  50. <td data-field="actions">
  51. <a class="grid-edit" data-bind="attr: { href: 'animals/' + id, title: name }, text: id"></a>
  52. </td>
  53. </tr>
  54. </tbody>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement