Skip to content

Commit 496e1f8

Browse files
authored
Merge pull request #2010 from adumesny/master
nested demo: added debug event handler
2 parents ec87754 + b4fc7c1 commit 496e1f8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

demo/nested.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ <h1>Nested grids demo</h1>
4949
<br><br>
5050
<!-- grid will be added here -->
5151
</div>
52-
52+
<script src="events.js"></script>
5353
<script type="text/javascript">
5454
let sub1 = [ {x:0, y:0}, {x:1, y:0}, {x:2, y:0}, {x:3, y:0}, {x:0, y:1}, {x:1, y:1}];
5555
let sub2 = [ {x:0, y:0}, {x:0, y:1, w:2}];
@@ -79,6 +79,13 @@ <h1>Nested grids demo</h1>
7979
// create and load it all from JSON above
8080
let grid = GridStack.addGrid(document.querySelector('.container-fluid'), options);
8181

82+
// add debug event handlers to each grid (no global set on parent yet)
83+
let gridEls = GridStack.getElements('.grid-stack');
84+
gridEls.forEach(gridEl => {
85+
let grid = gridEl.gridstack;
86+
addEvents(grid, grid.opts.id);
87+
})
88+
8289
function addNested() {
8390
grid.addWidget({x:0, y:100, content:"new item"});
8491
}

0 commit comments

Comments
 (0)