From b6d5f98f638138bcc9222b529105674de3aa65b0 Mon Sep 17 00:00:00 2001 From: CodeAnimal Date: Thu, 2 Oct 2014 12:18:29 +0100 Subject: [PATCH] Fix a bug in add_faux_cell This line checks that the row doesn't already exist in the gridmap array; if it does then it doesn't need to be pushed to the faux_grid array. Otherwise, this function introduced a bug when I was dynamically adding widgets that had a row height > 1 as the first widget added. Any subsequent widget added would end up being at row 2 (rather than row 3, as the first widget already occupied the first 2 rows). --- src/jquery.gridster.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/jquery.gridster.js b/src/jquery.gridster.js index 7bac9118..501561bf 100755 --- a/src/jquery.gridster.js +++ b/src/jquery.gridster.js @@ -2944,8 +2944,10 @@ this.gridmap[col] = []; } - this.gridmap[col][row] = false; - this.faux_grid.push(coords); + if (this.gridmap[col].length <= row) { + this.gridmap[col][row] = false; + this.faux_grid.push(coords); + } return this; };