From ef311e6fb1dfa9bfc89b09f5045fed8f126986bb Mon Sep 17 00:00:00 2001 From: Julien Chichignoud Date: Thu, 29 Jan 2015 11:12:22 +0100 Subject: [PATCH] add_widget() now returns the newly created widget --- README.md | 2 +- src/gridstack.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0799bc3..a930276 100644 --- a/README.md +++ b/README.md @@ -191,7 +191,7 @@ $('.grid-stack').on('resizestop', function (event, ui) { ### add_widget(el, x, y, width, height, auto_position) -Creates new widget. +Creates new widget and returns it. Parameters: diff --git a/src/gridstack.js b/src/gridstack.js index 8accee8..3e30cb3 100644 --- a/src/gridstack.js +++ b/src/gridstack.js @@ -582,6 +582,8 @@ this.container.append(el); this._prepare_element(el); this._update_container_height(); + + return el; }; GridStack.prototype.will_it_fit = function (x, y, width, height, auto_position) {