@@ -23,21 +23,20 @@ <h1>Float grid demo</h1>
2323 < script src ="events.js "> </ script >
2424 < script type ="text/javascript ">
2525 let grid = GridStack . init ( {
26- // float: false ,
26+ float : true ,
2727 // 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
3129 } ) ;
3230 addEvents ( grid ) ;
3331
34- let count = 0 ;
3532 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 }
3938 ] ;
40- items . forEach ( e => e . content = String ( count ++ ) ) ;
39+ let count = 0 ;
4140
4241 addNewWidget = function ( ) {
4342 let n = items [ count ] || {
@@ -46,15 +45,16 @@ <h1>Float grid demo</h1>
4645 w : Math . round ( 1 + 3 * Math . random ( ) ) ,
4746 h : Math . round ( 1 + 3 * Math . random ( ) )
4847 } ;
49- n . content = n . content || String ( count ++ ) ;
48+ n . content = n . content || String ( count ) ;
5049 grid . addWidget ( n ) ;
50+ count ++ ;
5151 } ;
5252
5353 toggleFloat = function ( ) {
5454 grid . float ( ! grid . getFloat ( ) ) ;
5555 document . querySelector ( '#float' ) . innerHTML = 'float: ' + grid . getFloat ( ) ;
5656 } ;
57- grid . load ( items ) ;
57+ addNewWidget ( ) ;
5858 </ script >
5959</ body >
6060</ html >
0 commit comments