Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var initialData = [
- { id: 1, name: "Well-Travelled Kitten", sales: 352, price: 75.95 },
- { id: 2, name: "Speedy Coyote", sales: 89, price: 190.00 },
- { id: 3, name: "Furious Lizard", sales: 152, price: 25.00 },
- { id: 4, name: "Indifferent Monkey", sales: 1, price: 99.95 },
- { id: 5, name: "Brooding Dragon", sales: 0, price: 6350 },
- { id: 6, name: "Ingenious Tadpole", sales: 39450, price: 0.35 },
- { id: 7, name: "Optimistic Snail", sales: 420, price: 1.50 }
- ];
- var ctor = function () {
- this.animals = ko.observableArray([]);
- this.disabled = ko.observable(false);
- this.activate = function () {
- this.animals(initialData);
- return true;
- }
- };
- //Note: This module exports a function. That means that you, the developer, can create multiple instances.
- //This pattern is also recognized by Durandal so that it can create instances on demand.
- return ctor;
- <h3>Customers</h3>
- <table id="animals" data-bind="grid: { data: animals }" >
- <caption>Amazing Animals</caption>
- <thead>
- <tr>
- <th data-field="actions" style="width:27px;"></th>
- <th data-field="name" width="150px">Item Name</th>
- <th data-field="sales">Sales Count</th>
- <th data-field="price">Price</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td data-field="actions">
- <a class="grid-edit" data-bind="attr: { href: 'animals/' + id, title: name }, text: id"></a>
- </td>
- </tr>
- </tbody>
- </table>
- <tbody data-bind='foreach:animals'>
- <tr>
- <td data-field="actions">
- <a class="grid-edit" data-bind="attr: { href: 'animals/' + id, title: name }, text: id"></a>
- </td>
- </tr>
- </tbody>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement