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.
- big re-write on how `cellHeight()` works. you can now call it at any time (not just grid init options) including switching to 'auto' or other modes on the fly. - fix `cellHeight:auto` now keeps cell square as window resizes (regressing from 2.x TS conversion). `Utils.throttle()` works better too (guaranteed to be called last event) - new `cellHeight:initial` which makes the cell squares initially, but doesn't change as windows resizes (better performance) - new grid option `cellHeightThrottle` (100ms) to control throttle of auto sizing triggers - fix gridstack#1600 - height too small with `cellHeight:auto` loading in 1 column. Now detect we load at 1 column and size accordingly (default 'auto' could make big 700x700 cells, so explicit px might still be wanted)
- Loading branch information
Showing
7 changed files
with
153 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<!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>cell height demo</title> | ||
|
||
<link rel="stylesheet" href="demo.css"/> | ||
<script src="../dist/gridstack-h5.js"></script> | ||
<style type="text/css"> | ||
.container { | ||
background-color: lightblue; | ||
width: 100%; | ||
height: 800px; | ||
} | ||
</style> | ||
|
||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>Cell Height grid options demo</h1> | ||
<p>sample showing the different cellHeight options and what happens when you resize the window</p> | ||
<div> | ||
<a class="btn btn-primary" onClick="setOpt('auto')" href="#">auto</a> | ||
<a class="btn btn-primary" onClick="setOpt('initial')" href="#">initial</a> | ||
<a class="btn btn-primary" onClick="setOpt(100)" href="#">100px</a> | ||
<a class="btn btn-primary" onClick="setOpt('10vh')" href="#">'10vh'</a> | ||
<a class="btn btn-primary" onClick="setOpt('10%')" href="#">'10%' of blue (broken)</a> | ||
<span>settings:</span><span id="info"></span> | ||
</div> | ||
<br> | ||
<div class="grid-stack"></div> | ||
</div> | ||
<script type="text/javascript"> | ||
let opts = { | ||
cellHeight: 'auto', // see other possible values (best to do in here) | ||
cellHeightThrottle: 100, | ||
} | ||
let grid = GridStack.init(opts); | ||
let items = [ | ||
{x:0, y:0, content:'0'}, | ||
{x:1, y:0, w:2, content:'1'}, | ||
{x:3, y:0, h:2, content:'2'}, | ||
]; | ||
grid.load(items); | ||
|
||
let info = document.querySelector('#info'); | ||
info.innerHTML = opts.cellHeight; | ||
setOpt = function(val) { | ||
grid.cellHeight(val); | ||
info.innerHTML = val; | ||
} | ||
</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
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
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