|
9 | 9 | <link rel="stylesheet" href="demo.css"/>
|
10 | 10 |
|
11 | 11 | <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
12 |
| - <script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.5.0/knockout-min.js"></script> |
| 12 | + <script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.5.0/knockout-debug.js"></script> |
13 | 13 | <script src="../src/jquery-ui.min.js"></script>
|
14 | 14 | <script src="../src/gridstack.js"></script>
|
15 | 15 | <script src="../src/gridstack.jQueryUI.js"></script>
|
@@ -54,8 +54,8 @@ <h1>knockout.js Demo</h1>
|
54 | 54 | template:
|
55 | 55 | [
|
56 | 56 | '<div class="grid-stack" data-bind="foreach: {data: widgets, afterRender: afterAddWidget}">',
|
57 |
| - ' <div class="grid-stack-item" data-bind="attr: {\'data-gs-x\': $data.x, \'data-gs-y\': $data.y, \'data-gs-width\': $data.width, \'data-gs-height\': $data.height, \'data-gs-auto-position\': $data.auto_position}">', |
58 |
| - ' <div class="grid-stack-item-content"><button data-bind="click: $root.deleteWidget">Delete me</button></div>', |
| 57 | + ' <div class="grid-stack-item" data-bind="attr: {\'data-gs-x\': $data.x, \'data-gs-y\': $data.y, \'data-gs-width\': $data.width, \'data-gs-height\': $data.height, \'data-gs-auto-position\': $data.auto_position, \'data-gs-id\': $data.id}">', |
| 58 | + ' <div class="grid-stack-item-content"><button data-bind="click: $root.deleteWidget">Delete me</button></div>', |
59 | 59 | ' </div>',
|
60 | 60 | '</div> '
|
61 | 61 | ].join('')
|
@@ -85,10 +85,10 @@ <h1>knockout.js Demo</h1>
|
85 | 85 | };
|
86 | 86 |
|
87 | 87 | var widgets = [
|
88 |
| - {x: 0, y: 0, width: 2, height: 2}, |
89 |
| - {x: 2, y: 0, width: 4, height: 2}, |
90 |
| - {x: 6, y: 0, width: 2, height: 4}, |
91 |
| - {x: 1, y: 2, width: 4, height: 2} |
| 88 | + {x: 0, y: 0, width: 2, height: 2, id: '0'}, |
| 89 | + {x: 2, y: 0, width: 4, height: 2, id: '1'}, |
| 90 | + {x: 6, y: 0, width: 2, height: 4, id: '2'}, |
| 91 | + {x: 1, y: 2, width: 4, height: 2, id: '3'} |
92 | 92 | ];
|
93 | 93 |
|
94 | 94 | var controller = new Controller(widgets);
|
|
0 commit comments