Skip to content

Commit 6fcb05a

Browse files
author
Alain Dumesny
committed
knockout demo Deleting widget issue
fix for #1015 TODO: udated demo to make it easier to debug/fix. I don't see the arraw changing order going 1 column. not sure of issue yet..
1 parent 3798b2a commit 6fcb05a

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

demo/knockout.html

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
<meta name="viewport" content="width=device-width, initial-scale=1">
1111
<title>Knockout.js demo</title>
1212

13-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
13+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.css">
1414
<link rel="stylesheet" href="../dist/gridstack.css"/>
1515

16-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
16+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.js"></script>
1717
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.js"></script>
18-
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
19-
<script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.6.9/shim.min.js"></script>
20-
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.5.0/knockout-min.js"></script>
18+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.js"></script>
19+
<script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.6.9/shim.js"></script>
20+
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.5.0/knockout-debug.js"></script>
2121
<script src="../src/gridstack.js"></script>
2222
<script src="../src/gridstack.jQueryUI.js"></script>
2323

@@ -77,8 +77,8 @@ <h1>knockout.js Demo</h1>
7777
template:
7878
[
7979
'<div class="grid-stack" data-bind="foreach: {data: widgets, afterRender: afterAddWidget}">',
80-
' <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}">',
81-
' <div class="grid-stack-item-content"><button data-bind="click: $root.deleteWidget">Delete me</button></div>',
80+
' <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}">',
81+
' <div class="grid-stack-item-content"><button data-bind="click: $root.deleteWidget">Delete me</button></div>',
8282
' </div>',
8383
'</div> '
8484
].join('')
@@ -108,10 +108,10 @@ <h1>knockout.js Demo</h1>
108108
};
109109

110110
var widgets = [
111-
{x: 0, y: 0, width: 2, height: 2},
112-
{x: 2, y: 0, width: 4, height: 2},
113-
{x: 6, y: 0, width: 2, height: 4},
114-
{x: 1, y: 2, width: 4, height: 2}
111+
{x: 0, y: 0, width: 2, height: 2, id: '0'},
112+
{x: 2, y: 0, width: 4, height: 2, id: '1'},
113+
{x: 6, y: 0, width: 2, height: 4, id: '2'},
114+
{x: 1, y: 2, width: 4, height: 2, id: '3'}
115115
];
116116

117117
var controller = new Controller(widgets);

0 commit comments

Comments
 (0)