Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Change log

## v0.5.2-dev (upcoming changes)

- fix moving widgets when having multiple grids. jquery-ui workaround ([#1043](https://github.com/gridstack/gridstack.js/issues/1043)).
- switch to eslint ([#763](https://github.com/gridstack/gridstack.js/issues/763)).
- null values to addWidget() exception fix ([#1042](https://github.com/gridstack/gridstack.js/issues/1042)).

Expand Down
9 changes: 8 additions & 1 deletion src/gridstack.js
Original file line number Diff line number Diff line change
Expand Up @@ -974,18 +974,24 @@
draggingElement = el;

var node = self.grid._prepareNode({width: width, height: height, _added: false, _temporary: true});
node.isOutOfGrid = true;
el.data('_gridstack_node', node);
el.data('_gridstack_node_orig', origNode);

el.on('drag', onDrag);
})
.on(self.container, 'dropout', function(event, ui) {
// jquery-ui bug. Must verify widget is being dropped out
// check node variable that gets set when widget is out of grid
var el = $(ui.draggable);
if (!el.data('_gridstack_node')) {
return;
}
el.unbind('drag', onDrag);
var node = el.data('_gridstack_node');
if (!node.isOutOfGrid) {
return;
}
el.unbind('drag', onDrag);
node.el = null;
self.grid.removeNode(node);
self.placeholder.detach();
Expand All @@ -996,6 +1002,7 @@
self.placeholder.detach();

var node = $(ui.draggable).data('_gridstack_node');
node.isOutOfGrid = false;
node._grid = self;
var el = $(ui.draggable).clone(false);
el.data('_gridstack_node', node);
Expand Down