Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Responsive grids don't render items with minW correctly on resize #2676

Closed
rory-orennia opened this issue May 16, 2024 · 7 comments · Fixed by #2680
Closed

Responsive grids don't render items with minW correctly on resize #2676

rory-orennia opened this issue May 16, 2024 · 7 comments · Fixed by #2680
Labels

Comments

@rory-orennia
Copy link

Subject of the issue

If you setup responsive column breakpoints and also set the minW on a widget, and resize the window/grid down to something smaller than that minW, it will render incorrectly on resize and seems to just grab the minW * currentColWidth resulting in this:
image

Your environment

  • version of gridstack.js - 10.1.2
  • MacOS - Firefox

Steps to reproduce

https://jsfiddle.net/qjb3faLk/1/

  • Attempt to resize 0, works fine.
  • Attempt to resize 1, it expands outside the browser while resizing

Expected behavior

The resize display should be the size of the widget, even if that widget is currently smaller than the minW

@rory-orennia
Copy link
Author

Seems to be caused by this function:

protected _constrainSize(oWidth: number, oHeight: number): Size {

@afhammad
Copy link

+1

Was just evaluating gridstack and testing it's responsive handling and ran into this.

adumesny added a commit to adumesny/gridstack.js that referenced this issue May 25, 2024
@adumesny
Copy link
Member

fixed in next release. don't forget to donate if you find this lib useful!

@gazhay
Copy link

gazhay commented Jul 25, 2024

Anytime I specify column in init options or via javascript after load all my items widths shrink to 0.

similarly with most other "responsive" columnOpts.

I am using bootstrap "container-fluid" on the parent of the grid-stack div, but I think something about the responsiveness is fundamentally broken.

@adumesny
Copy link
Member

adumesny commented Jul 25, 2024

something about the responsiveness is fundamentally broken.

@gazhay well that doesn't help without a demo showing the issue. also often people forget to include the correct CSS for other than 12 column layouts (extra.css)

@gazhay
Copy link

gazhay commented Jul 26, 2024

Can't seem to find an extra.css in the npm dist

dd-base-impl.d.ts    dd-droppable.js.map  dd-manager.js               dd-touch.d.ts                 gridstack-engine.js      utils.d.ts
dd-base-impl.js      dd-element.d.ts      dd-manager.js.map           dd-touch.js                   gridstack-engine.js.map  utils.js
dd-base-impl.js.map  dd-element.js        dd-resizable.d.ts           dd-touch.js.map               gridstack.js             utils.js.map
dd-draggable.d.ts    dd-element.js.map    dd-resizable-handle.d.ts    gridstack-all.js              gridstack.js.map
dd-draggable.js      dd-gridstack.d.ts    dd-resizable-handle.js      gridstack-all.js.LICENSE.txt  gridstack-poly.js
dd-draggable.js.map  dd-gridstack.js      dd-resizable-handle.js.map  gridstack-all.js.map          types.d.ts
dd-droppable.d.ts    dd-gridstack.js.map  dd-resizable.js             gridstack.d.ts                types.js
dd-droppable.js      dd-manager.d.ts      dd-resizable.js.map         gridstack-engine.d.ts         types.js.map

I am also aware I wasn't helpful for not posting a demo, but I literally was just putting together code from the docs and examples - nothing extra at all - pun intended.

I'll see if I can scrape extra.css from an example or something.

@adumesny
Copy link
Member

image
from 10.3 gzip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants