You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fill smaller gaps if grid-stack-item is too big #3179
Currently we are using v10.x.x of your library.
We would like a feature where we can fill smaller gaps in the grid if present.
We came up with the idea to change the grid-stack-items size (to 1 x 1) on the dragstart event with the grid.update() function. Reason to do this is while the placeholder cannot shrink, so we have to shrink before the placeholder is created. Next step was using the drag event to find a gap in the grid matrix - we create on drag start.
But the grid.update() function gives us an error in the console log. I believe the library does not permit us to use this function during a drag event.
It is complaining about missing _orig.w, at least when we start changing the grid-stack-size on the event dragstop event function to fill the entire free gap space.
With the newer library we found a similar error, complaining about .left if I'm not mistaking.
Is there a solution for this approach?
This would be a great feature.
you are asking for a 'shrinkToFit' kinda of functionality where an item can always (constrained to minW/H if set) fit if any space is available in he grid, irrespective if the initial size.
That feature could be added for the right donation maybe (could be a lot of work)... hacking the existing methods are likely the wrong way to look at it (content will reflow with float:false during some resizing as well...
Activity
adumesny commentedon Nov 5, 2025
you are asking for a 'shrinkToFit' kinda of functionality where an item can always (constrained to minW/H if set) fit if any space is available in he grid, irrespective if the initial size.
That feature could be added for the right donation maybe (could be a lot of work)... hacking the existing methods are likely the wrong way to look at it (content will reflow with float:false during some resizing as well...
* fix gridstack#3179 unblock app-side shrink-to-fit during a drag
adumesny commentedon Sep 15, 2026
won't crash anymore, but it's up to ypou to make the 1x1 sizing and logic. Lib isn't supporting out of the box.
* fix gridstack#3179 unblock app-side shrink-to-fit during a drag
Merge pull request #3399 from adumesny/3179-shrinkToFit