Skip to content

Fill smaller gaps if grid-stack-item is too big #3179

Closed

Description

@marioderksen

Hi Alain,

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.

Regards, Mario

Activity

  1. adumesny commented on Nov 5, 2025

    @adumesny
    Member

    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...

  2. added a commit that references this issue on Sep 15, 2026
    2947c2e
  3. adumesny commented on Sep 15, 2026

    @adumesny
    Member

    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.

  4. added 2 commits that reference this issue on Sep 15, 2026
    62c4f90
    ec5679a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions