@@ -62,9 +65,23 @@
Nested grids demo
dragOut: true // let us drag them out!
};
$('.grid-stack.top').gridstack();
- $('.grid-stack.nested1').gridstack(nestOptions);
+ var grid1 = $('.grid-stack.nested1').gridstack(nestOptions).data('gridstack');
nestOptions.dragOut = false;
- $('.grid-stack.nested2').gridstack(nestOptions);
+ var grid2 = $('.grid-stack.nested2').gridstack(nestOptions).data('gridstack');
+
+ var count = 9;
+ addNewWidget = function(grid) {
+ var node = {
+ x: Math.round(12 * Math.random()),
+ y: Math.round(5 * Math.random()),
+ width: Math.round(1 + 3 * Math.random()),
+ height: Math.round(1 + 3 * Math.random())
+ };
+ grid.addWidget($('
'), node);
+ return false;
+ };
+ $('#add-widget1').click(function () { addNewWidget(grid1)});
+ $('#add-widget2').click(function () { addNewWidget(grid2)});
});
diff --git a/src/gridstack.d.ts b/src/gridstack.d.ts
index 2394b40d2..a15a56735 100644
--- a/src/gridstack.d.ts
+++ b/src/gridstack.d.ts
@@ -444,10 +444,15 @@ interface GridstackOptions {
disableResize ? : boolean;
/**
- * allows to override jQuery UI draggable options. (default?: { handle?: '.grid-stack-item-content', scroll?: true, appendTo?: 'body' })
+ * allows to override jQuery UI draggable options. (default?: { handle?: '.grid-stack-item-content', scroll?: true, appendTo?: 'body', containment: null })
*/
draggable ? : {};
+ /**
+ * let user drag nested grid items out of a parent or not (default false)
+ */
+ dragOut ? : boolean;
+
/**
* draggable handle selector (default?: '.grid-stack-item-content')
*/