2222 opacity : 0.8 ;
2323 filter : blur (5px );
2424 }
25+ .sidepanel-item {
26+ background-color : # 18bc9c ;
27+ text-align : center;
28+ padding : 5px ;
29+ margin-bottom : 15px ;
30+ }
2531 # trash {
26- background : rgba (255 , 0 , 0 , 0.4 );
32+ background-color : rgba (255 , 0 , 0 , 0.4 );
33+ }
34+ ion-icon {
35+ font-size : 300% ;
2736 }
2837 </ style >
2938</ head >
3241 < h1 > Advanced Demo</ h1 >
3342 < div class ="row ">
3443 < div class ="sidepanel col-md-2 d-none d-md-block ">
35- < div id ="trash " style ="padding: 5px; margin-bottom: 15px; " class ="text-center ">
36- < div >
37- < ion-icon name ="trash " style ="font-size: 300% "> </ ion-icon >
38- </ div >
39- < div >
40- < span > Drop here to remove!</ span >
41- </ div >
44+ < div id ="trash " class ="sidepanel-item ">
45+ < ion-icon name ="trash "> </ ion-icon >
46+ < div > Drop here to remove!</ div >
4247 </ div >
43- < div class ="grid-stack-item " gs-h ="2 ">
44- < div class ="grid-stack-item-content " style ="padding: 5px; ">
45- < div >
46- < ion-icon name ="add-circle " style ="font-size: 300% "> </ ion-icon >
47- </ div >
48- < div >
49- < span > Drag me in the dashboard!</ span >
50- </ div >
51- </ div >
48+ < div class ="grid-stack-item sidepanel-item ">
49+ < ion-icon name ="add-circle "> </ ion-icon >
50+ < div > Drag me in the dashboard!</ div >
5251 </ div >
5352 </ div >
5453 < div class ="col-sm-12 col-md-10 ">
@@ -62,17 +61,10 @@ <h1>Advanced Demo</h1>
6261 el . innerHTML = w . content ;
6362 } ;
6463
65- let grid = GridStack . init ( {
66- cellHeight : 70 ,
67- acceptWidgets : true ,
68- removable : '#trash' , // drag-out delete class
69- } ) ;
70- GridStack . setupDragIn ( '.sidepanel>.grid-stack-item' ) ;
71-
72- let items = [
64+ let children = [
7365 { x : 0 , y : 0 , w : 4 , h : 2 , content : '1' } ,
74- { x : 4 , y : 0 , w : 4 , h : 4 , noMove : true , noResize : true , locked : true , content : 'I can\'t be moved or dragged!<br><ion-icon name="ios-lock" style="font-size:300% "></ion-icon>' } ,
75- { x : 8 , y : 0 , w : 2 , h : 2 , minW : 2 , noResize : true , content : '<p class="card-text text-center" style="margin-bottom: 0">Drag me!<p class="card-text text-center"style="margin-bottom: 0"><ion-icon name="hand" style="font-size: 300%" ></ion-icon><p class="card-text text-center" style="margin-bottom: 0">...but don\'t resize me!' } ,
66+ { x : 4 , y : 0 , w : 4 , h : 4 , locked : true , content : 'I can\'t be moved or dragged, nor pushed by others !<br><ion-icon name="ios-lock"></ion-icon>' } ,
67+ { x : 8 , y : 0 , w : 2 , h : 2 , minW : 2 , noResize : true , content : '<p class="card-text text-center" style="margin-bottom: 0">Drag me!<p class="card-text text-center"style="margin-bottom: 0"><ion-icon name="hand"></ion-icon><p class="card-text text-center" style="margin-bottom: 0">...but don\'t resize me!' } ,
7668 { x : 10 , y : 0 , w : 2 , h : 2 , content : '4' } ,
7769 { x : 0 , y : 2 , w : 2 , h : 2 , content : '5' } ,
7870 { x : 2 , y : 2 , w : 2 , h : 4 , content : '6' } ,
@@ -82,7 +74,15 @@ <h1>Advanced Demo</h1>
8274 { x : 8 , y : 4 , w : 2 , h : 2 , content : '10' } ,
8375 { x : 10 , y : 4 , w : 2 , h : 2 , content : '11' } ,
8476 ] ;
85- grid . load ( items ) ;
77+ let insert = [ { h : 2 , content : 'new item' } ] ;
78+
79+ let grid = GridStack . init ( {
80+ cellHeight : 70 ,
81+ acceptWidgets : true ,
82+ removable : '#trash' , // drag-out delete class
83+ children
84+ } ) ;
85+ GridStack . setupDragIn ( '.sidepanel>.grid-stack-item' , undefined , insert ) ;
8686
8787 grid . on ( 'added removed change' , function ( e , items ) {
8888 let str = '' ;
0 commit comments