forked from gridstack/gridstack.js
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 column mode loading, saving 12 column layout
fix gridstack#1985 fix gridstack#1975 (oneColumnModeDomSort case) * we now handle DOM and addWidget() when temporally into 1 column mode better to save the full 12 column mode * also DOM reading will reverse-sort entries to lay them in 1 column mode correctly (like if you had started with 12 and scaled down)
- Loading branch information
Showing
6 changed files
with
86 additions
and
23 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,38 @@ | ||
<!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>read 1 column</title> | ||
|
||
<link rel="stylesheet" href="../../../demo/demo.css"/> | ||
<script src="../../../dist/gridstack-all.js"></script> | ||
|
||
</head> | ||
<body> | ||
<div class="container-fluid"> | ||
<h1>read from dom into 1 column has wrong order and 12 column layout</h1> | ||
<div class="grid-stack"> | ||
<div class="grid-stack-item" gs-x="4" gs-y="0"><div class="grid-stack-item-content">1</div></div> | ||
<div class="grid-stack-item" gs-x="0" gs-y="0"><div class="grid-stack-item-content">0</div></div> | ||
<div class="grid-stack-item" gs-x="1" gs-y="1"><div class="grid-stack-item-content">2</div></div> | ||
</div> | ||
</div> | ||
<script type="text/javascript"> | ||
let grid = GridStack.init({ | ||
cellHeight: 70, | ||
float: true, | ||
}); | ||
|
||
var items = [ | ||
{x: 0, y: 0, content: '0'}, | ||
{x: 2, y: 0, content: '1'}, | ||
]; | ||
// grid.addWidget(items[1]); // need to be reverse sort-order to be correct (otherwise DOM above is wrong) | ||
// grid.addWidget(items[0]); | ||
// grid.load(items); // or this work (code reverse sort) | ||
|
||
</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