@@ -23,21 +23,20 @@ <h1>Float grid demo</h1>
23
23
< script src ="events.js "> </ script >
24
24
< script type ="text/javascript ">
25
25
let grid = GridStack . init ( {
26
- // float: false ,
26
+ float : true ,
27
27
// disableResize: true, // TEST no resizing, but dragging
28
- // resizable: { handles: 'all'} // do all sides for testing
29
- // draggable: { pause: true },
30
- subGrid : { createDynamic : true , column : 'auto' } ,
28
+ resizable : { handles : 'all' } // do all sides for testing
31
29
} ) ;
32
30
addEvents ( grid ) ;
33
31
34
- let count = 0 ;
35
32
let items = [
36
- { x : 0 , y : 0 } ,
37
- { x : 1 , y : 0 } ,
38
- { x : 2 , y : 0 , w : 2 } ,
33
+ { x : 1 , y : 1 } , //, locked:true, content:"locked"},
34
+ { x : 2 , y : 2 , w : 3 } ,
35
+ { x : 4 , y : 2 } ,
36
+ { x : 3 , y : 1 , h : 2 } ,
37
+ { x : 0 , y : 6 , w : 2 , h : 2 }
39
38
] ;
40
- items . forEach ( e => e . content = String ( count ++ ) ) ;
39
+ let count = 0 ;
41
40
42
41
addNewWidget = function ( ) {
43
42
let n = items [ count ] || {
@@ -46,15 +45,16 @@ <h1>Float grid demo</h1>
46
45
w : Math . round ( 1 + 3 * Math . random ( ) ) ,
47
46
h : Math . round ( 1 + 3 * Math . random ( ) )
48
47
} ;
49
- n . content = n . content || String ( count ++ ) ;
48
+ n . content = n . content || String ( count ) ;
50
49
grid . addWidget ( n ) ;
50
+ count ++ ;
51
51
} ;
52
52
53
53
toggleFloat = function ( ) {
54
54
grid . float ( ! grid . getFloat ( ) ) ;
55
55
document . querySelector ( '#float' ) . innerHTML = 'float: ' + grid . getFloat ( ) ;
56
56
} ;
57
- grid . load ( items ) ;
57
+ addNewWidget ( ) ;
58
58
</ script >
59
59
</ body >
60
60
</ html >
0 commit comments