Open gertjanwytynck opened 11 years ago
I get the same error when executing remove_widget function.
Here is an example on how to remove a widget:
var gridster = $('.gridster ul').gridster(...).data('gridster'); gridster.remove_widget($("#widget_one"));
I encountered this too.
I'm removing 2 widgets in a for-statement, like this:
for (k in views){
var el = $('#' + k);
if (!views[k]) {
gridster.remove_widget(el, false);
}
}
The widgets are on the same column, they get removed, the widget below moves up 1 (just 1) row. Then, whenever I drag a widget over the empty cell (where the top widget died) it throws me the exception @gertjanwytynck is having.
+1
+1
+1
+1
Solve to me:
gridster = $('.gridster ul:first').data('gridster')
gridster.remove_widget($(@node).parent(), true)
$(@node).empty()
In my application i had to remove the Element from the dom after use the remove_widget function and put a validation to prevent the card to moveup inside the remove_widget function in this part:
$el.fadeOut($.proxy(function() {
$el.remove();
$nexts.each($.proxy(function(i, widget) {
if($(widget).coords().grid)
{
this.move_widget_up( $(widget), wgd.size_y );
}
}, this));
inside the $next.each i did a validation verifying if the coords are not undefined and never had the problem again! i don't think this is the better solution but it is working :)
I'm trying to remove all the widgets with the class 'extraColumn1'. (I have 4 widgets with this class).
My code: gridster.remove_widget($('.extraColumn1'));
All the widgets are removed but I got an error in the console -> (4) 'Uncaught TypeError: Cannot read property 'row' of undefined'
I did this-> https://github.com/ducksboard/gridster.js/issues/63 but no success..
Thanks in advance!