Closed
Description
If I increase the width of the gridstack container and immediately call .cellHeight()
to re-compute row height, there's no effect, I need to wait a bit before calling .cellHeight()
:
const hostEl = document.querySelector('#grid');
const grid = GridStack.init({
column: 12,
cellHeight: 'initial',
float: false,
}, hostEl);
grid.addWidget({w: 2, h: 2, content: 'item 1'});
document.querySelector('#increase-width')
.addEventListener('click', function() {
hostEl.style.width = '1000px';
// doesn't work
grid.cellHeight('initial');
// but works with timeout
setTimeout(()=>grid.cellHeight('initial'), 300);
});
I'm wondering if there's a better approach than arbitrary timeout? Maybe there's some kind of event I can subscribe to?
Appreciate any input!