gridstack.js: grid doesnt deactivate droppable properly when using acceptWidgets
I have an issue when adding multiple external items via drag and drop. The first draggable item works well, the grid activates and shows the placeholder and moves existing nodes out of the way.
The problem is with subsequent items, the grid doesn’t activate immediately like the first item. It will start working if the new dragged item is moved out and triggers the draggable dropout event.
I tracked it down to an issue with gridstack preventing droppable from calling deactivate after the item is dropped.
And I fixed it by changing gridstacks droppable accept function to check node._temporary
Before:
this.dd
.droppable(self.container, {
accept: function(el) {
el = $(el);
var node = el.data('_gridstack_node');
if (node && node._grid === self) {
return false;
}
return el.is(self.opts.acceptWidgets === true ? '.grid-stack-item' : self.opts.acceptWidgets);
}
})
After:
this.dd
.droppable(self.container, {
accept: function(el) {
el = $(el);
var node = el.data('_gridstack_node');
if (node && !node._temporary && node._grid === self) {
return false;
}
return el.is(self.opts.acceptWidgets === true ? '.grid-stack-item' : self.opts.acceptWidgets);
}
})
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18 (3 by maintainers)
@mishrarajesh @jun1432 @polenginlabu @benjamincfaustino The fix for me was: https://github.com/jquery/jquery-ui/pull/1181/commits/2228050b2c3312267ade756168419b972721f157
I have the same issue, do we know in which revision the workaround stopped working?