Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions demo/float.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ <h1>Float grid demo</h1>

this.addNewWidget = function() {
var node = this.items[count] || {
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())
};
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())
};
this.grid.addWidget($('<div><div class="grid-stack-item-content">' + count++ + '</div></div>'), node);
return false;
}.bind(this);
Expand Down
21 changes: 19 additions & 2 deletions demo/nested.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
<body>
<div class="container-fluid">
<h1>Nested grids demo</h1>
<a class="btn btn-primary" id="add-widget1" href="#">Add Widget Grid1</a>
<a class="btn btn-primary" id="add-widget2" href="#">Add Widget Grid2</a>
<br><br>

<div class="grid-stack top">
<div class="grid-stack-item" data-gs-x="0" data-gs-y="0" data-gs-width="1" data-gs-height="1">
Expand Down Expand Up @@ -62,9 +65,23 @@ <h1>Nested grids demo</h1>
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($('<div class="grid-stack-item sub"><div class="grid-stack-item-content">' + count++ + '</div></div>'), node);
return false;
};
$('#add-widget1').click(function () { addNewWidget(grid1)});
$('#add-widget2').click(function () { addNewWidget(grid2)});
});
</script>
</body>
Expand Down
7 changes: 6 additions & 1 deletion src/gridstack.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
*/
Expand Down