-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
static.html
58 lines (51 loc) · 1.77 KB
/
static.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Static Grid</title>
<link rel="stylesheet" href="demo.css"/>
<script src="../dist/gridstack-all.js"></script>
</head>
<body>
<div class="container-fluid">
<h1>Static vs can move/drag Demo</h1>
<p>we start with a static grid (no drag&drop initialized) with button to make it editable.</p>
<div class="sidebar" style="height:50px">
<div class="grid-stack-item">
<div class="grid-stack-item-content">Drag me</div>
</div>
<div class="grid-stack-item" gs-w="2" gs-h="1" gs-max-w="3">
<div class="grid-stack-item-content">2x1, max=3</div>
</div>
</div>
<div>
<a class="btn btn-primary" onClick="grid.setStatic(true)" href="#">Static</a>
<a class="btn btn-primary" onclick="grid.setStatic(false)" id="float" href="#">Editable</a>
</div>
<div class="grid-stack"></div>
</div>
<script src="events.js"></script>
<script type="text/javascript">
let grid = GridStack.init({
float: true,
cellHeight: 70,
acceptWidgets: true,
removable: true,
staticGrid: true
});
addEvents(grid);
let serializedData = [
{x: 0, y: 0, w: 2, h: 2, id: '0'},
{x: 3, y: 1, h: 2, id: 'no_move', noMove: true, content: 'no move'},
{x: 4, y: 1, id: '2'},
{x: 2, y: 3, w: 3, id: 'no_resize', noResize: true, content: 'no resize'},
{x: 1, y: 3, id: 'locked', locked: true, content: 'locked'}
];
grid.load(serializedData);
GridStack.setupDragIn('.sidebar>.grid-stack-item');
// grid.setStatic(false); // TEST enable after disabled
</script>
</body>
</html>