Skip to content

Commit d6f590e

Browse files
author
Alain Dumesny
authored
Merge pull request #1052 from adumesny/bugfix/1015
knockout demo Deleting widget issue
2 parents c5bb259 + d647399 commit d6f590e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

demo/knockout.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<link rel="stylesheet" href="demo.css"/>
1010

1111
<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>
1313
<script src="../src/jquery-ui.min.js"></script>
1414
<script src="../src/gridstack.js"></script>
1515
<script src="../src/gridstack.jQueryUI.js"></script>
@@ -54,8 +54,8 @@ <h1>knockout.js Demo</h1>
5454
template:
5555
[
5656
'<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>',
5959
' </div>',
6060
'</div> '
6161
].join('')
@@ -85,10 +85,10 @@ <h1>knockout.js Demo</h1>
8585
};
8686

8787
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'}
9292
];
9393

9494
var controller = new Controller(widgets);

0 commit comments

Comments
 (0)