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.
This commit is contained in:
Wouter Roosendaal
2013-05-13 16:14:47 +02:00
parent 5569caa687
commit 826120bdb1
+7 -2
View File
@@ -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;
};