From 826120bdb16438b4b36b1e5cd2010a74432cc34e Mon Sep 17 00:00:00 2001 From: Wouter Roosendaal Date: Mon, 13 May 2013 16:14:47 +0200 Subject: [PATCH] resize_widget function with callback parameter Is it possible to add a callback to the resize_widget function, that is called when the resizing of a widget is finished? This may help to update the widget content properly. --- src/jquery.gridster.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/jquery.gridster.js b/src/jquery.gridster.js index 3ca91b450..45bfc97e6 100644 --- a/src/jquery.gridster.js +++ b/src/jquery.gridster.js @@ -190,7 +190,7 @@ - /** + /** * Change the size of a widget. * * @method resize_widget @@ -198,9 +198,10 @@ * representing the widget. * @param {Number} size_x The number of columns that will occupy the widget. * @param {Number} size_y The number of rows that will occupy the widget. + * @param {Function} callback Function executed when the widget is removed. * @return {HTMLElement} Returns $widget. */ - fn.resize_widget = function($widget, size_x, size_y) { + fn.resize_widget = function($widget, size_x, size_y, callback) { var wgd = $widget.coords().grid; size_x || (size_x = wgd.size_x); size_y || (size_y = wgd.size_y); @@ -319,6 +320,10 @@ this.remove_empty_cells.apply(this, rows_to_remove_holes); } + if (callback) { + callback.call(this, size_x, size_y); + } + return $widget; };