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
2 changes: 1 addition & 1 deletion demo/nested.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ <h1>Nested grids demo</h1>
disableOneColumnMode: true, // nested are small, but still want N columns
margin: 1
};
GridStack.init(null, '.grid-stack.top');
GridStack.init({cellHeight: 70}, '.grid-stack.top');
let grid1 = GridStack.init(nestOptions, '.grid-stack.nested1');
nestOptions.dragOut = false;
let grid2 = GridStack.init(nestOptions, '.grid-stack.nested2');
Expand Down
1 change: 1 addition & 0 deletions doc/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Change log
- fix `minWidth()`, `minHeight()`, `maxHeight()` to set node value as well [1359](https://github.com/gridstack/gridstack.js/issues/1359)
- fix `GridStackOptions` spelling [1359](https://github.com/gridstack/gridstack.js/issues/1359)
- fix remove window resize event when `grid.destroy()` [1369](https://github.com/gridstack/gridstack.js/issues/1369)
- fix nested grid resize [1361](https://github.com/gridstack/gridstack.js/issues/1361)

## 2.0.0 (2020-09-07)

Expand Down
18 changes: 4 additions & 14 deletions src/gridstack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1197,18 +1197,18 @@ export class GridStack {

/** called when item starts moving/resizing */
let onStartMoving = (event, ui) => {
let target: HTMLElement = event.target;

// trigger any 'dragstart' / 'resizestart' manually
if (this._gsEventHandler[event.type]) {
this._gsEventHandler[event.type](event, event.target);
this._gsEventHandler[event.type](event, target);
}

this.engine.cleanNodes();
this.engine.beginUpdate(node);
cellWidth = this.cellWidth();
cellHeight = this.getCellHeight();

let { target } = event;

this.placeholder.setAttribute('data-gs-x', target.getAttribute('data-gs-x'));
this.placeholder.setAttribute('data-gs-y', target.getAttribute('data-gs-y'));
this.placeholder.setAttribute('data-gs-width', target.getAttribute('data-gs-width'));
Expand All @@ -1219,20 +1219,10 @@ export class GridStack {
node._beforeDragX = node.x;
node._beforeDragY = node.y;
node._prevYPix = ui.position.top;
let minHeight = (node.minHeight || 1);

// mineHeight - Each row is cellHeight + margin
this.dd.resizable(el, 'option', 'minWidth', cellWidth * (node.minWidth || 1));
this.dd.resizable(el, 'option', 'minHeight', cellHeight * minHeight);

if (event.type === 'resizestart') {
let itemElement = target.querySelector('.grid-stack-item') as HTMLElement;
if (itemElement) {
let ev = document.createEvent('HTMLEvents');
ev.initEvent('resizestart', true, false);
itemElement.dispatchEvent(event);
}
}
this.dd.resizable(el, 'option', 'minHeight', cellHeight * (node.minHeight || 1));
}

/** called when item is being dragged/resized */
Expand Down