gridstack / gridstack.js

Build interactive dashboards in minutes.
https://gridstackjs.com
MIT License
6.69k stars 1.28k forks source link

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

Closed rory-orennia closed 4 months ago

rory-orennia commented 4 months ago

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

Steps to reproduce

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

Expected behavior

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

rory-orennia commented 4 months ago

Seems to be caused by this function: https://github.com/gridstack/gridstack.js/blob/9b6c68fc04bbb711eb93cdd427a334231e537353/src/dd-resizable.ts#L287

afhammad commented 4 months ago

+1

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

adumesny commented 4 months ago

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

gazhay commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

image from 10.3 gzip