forked from gridstack/gridstack.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix gridstack#2394] * better fix that makes sure we keep wanted size when an item is dropped on us (so we remember in case we change grid column) * also changed to not save x,y during dropping since the drag behavior will figure where to put it, and that means we don't cache that layout that might not apply to the new grid anyway. * added a running example showing issue.
- Loading branch information
Showing
4 changed files
with
71 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<!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>#2394 Save sub item moved</title> | ||
|
||
<link rel="stylesheet" href="../../../demo/demo.css" /> | ||
<link rel="stylesheet" href="../../../dist/gridstack-extra.min.css"/> | ||
<script src="../../../dist/gridstack-all.js"></script> | ||
|
||
</head> | ||
<body> | ||
<h1>#2394 Save sub item moved</h1> | ||
<button onClick="print()">Save</button> | ||
<!-- <button onClick="reset()">Reset</button> --> | ||
<button onClick="load()">Load</button> | ||
<br><br> | ||
<div class="grid-stack"></div> | ||
|
||
<script type="text/javascript"> | ||
let subGridOpts = { | ||
cellHeight: 50, | ||
column: 3, | ||
padding: 5, | ||
minRow: 2, // don't collapse when empty | ||
disableOneColumnMode: true, | ||
acceptWidgets: true, | ||
children: [ {id:0, x:0, y:0, w:3, content:'move to parent grid col=2'}] | ||
}; | ||
|
||
var options = { // put in gridstack options here | ||
disableOneColumnMode: true, // for jfiddle small window size | ||
cellHeight: 70, | ||
column: 2, | ||
minRow: 3, | ||
acceptWidgets: true, | ||
children: [ | ||
{id:1, x:0, y:0, w:2, h:2, content:'3 columns', subGridOpts: subGridOpts }, | ||
{id:2, x:0, y:2, w:1, y:1, content:'widget' } | ||
] | ||
}; | ||
var grid = GridStack.init(options); | ||
var layout; | ||
|
||
print = function() { | ||
layout = grid.save(false, false); | ||
console.log(layout); | ||
} | ||
load = function() { | ||
grid.load(layout); | ||
} | ||
// reset = function() { | ||
// grid.removeAll(); | ||
// } | ||
print() | ||
</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