Skip to content

Commit 1a0ba3f

Browse files
committed
more load() 1 column fixes
more for #1471 * make sure we load() from last to first so any collision match 12 -> 1
1 parent d9c2241 commit 1a0ba3f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/gridstack.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ export class GridStack {
389389
* see http://gridstackjs.com/demo/serialization.html
390390
**/
391391
public load(layout: GridStackWidget[], addAndRemove: boolean | ((w: GridStackWidget, add: boolean) => void) = true): GridStack {
392-
let items = GridStack.Utils.sort(layout);
392+
let items = GridStack.Utils.sort(layout, -1, this._prevColumn || this.opts.column);
393393

394394
// if we're loading a layout into 1 column (_prevColumn is set only when going to 1) and items don't fit, make sure to save
395395
// the original wanted layout so we can scale back up correctly #1471
@@ -1264,7 +1264,7 @@ export class GridStack {
12641264
// remove any key not found (null or false which is default)
12651265
for (const key in node) {
12661266
if (!node.hasOwnProperty(key)) { return; }
1267-
if (node[key] === null || node[key] === false) {
1267+
if (!node[key] && node[key] !== 0) { // 0 can be valid value (x,y only really)
12681268
delete node[key];
12691269
}
12701270
}

0 commit comments

Comments
 (0)