forked from gridstack/gridstack.js
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix gridstack#1658 * we now set the grid options BEFORE we update each item as that override * enableMove() and enableResize() no longer take a second optional param as we must set grid options for things to work (if you want to enable current items but not change the grid itself, there is already the `movable('.grid-stack-item')` method that doesn't change the grid (no need for 2 ways) * did some more cleanup and added test case.
- Loading branch information
Showing
7 changed files
with
170 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>Float grid demo</title> | ||
|
||
<link rel="stylesheet" href="../../../demo/demo.css"/> | ||
<script src="../../../dist/gridstack-h5.js"></script> | ||
|
||
</head> | ||
<body> | ||
<div class="container-fluid"> | ||
<h1>Float grid demo</h1> | ||
<div> | ||
<a class="btn btn-primary" onClick="addNewWidget()" href="#">Add Widget</a> | ||
<a class="btn btn-primary" onclick="toggleFloat()" id="float" href="#">float: true</a> | ||
<a class="btn btn-primary" onclick="grid.enableMove(true)" href="#">enable</a> | ||
<a class="btn btn-primary" onclick="grid.disable()" href="#">disable</a> | ||
</div> | ||
<br><br> | ||
<div class="grid-stack"></div> | ||
</div> | ||
<script src="../../../demo/events.js"></script> | ||
<script type="text/javascript"> | ||
let grid = GridStack.init({disableResize: true, disableDrag: true}); | ||
addEvents(grid); | ||
|
||
let items = [ | ||
{x: 1, y: 1}, | ||
{x: 2, y: 2, w: 3}, | ||
{x: 4, y: 2}, | ||
{x: 3, y: 1, h: 2}, | ||
{x: 0, y: 6, w: 2, h: 2} | ||
]; | ||
let count = 0; | ||
|
||
addNewWidget = function() { | ||
let n = items[count] || { | ||
x: Math.round(12 * Math.random()), | ||
y: Math.round(5 * Math.random()), | ||
w: Math.round(1 + 3 * Math.random()), | ||
h: Math.round(1 + 3 * Math.random()) | ||
}; | ||
n.content = String(count++); | ||
grid.addWidget(n); | ||
}; | ||
|
||
toggleFloat = function() { | ||
grid.float(! grid.getFloat()); | ||
document.querySelector('#float').innerHTML = 'float: ' + grid.getFloat(); | ||
}; | ||
addNewWidget(); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.