gridstack / gridstack.js

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

The Change event is not always fired when items have changed after dragging #2687

Closed adholland closed 1 month ago

adholland commented 1 month ago

Subject of the issue

The Change event is not always fired when items have changed within the grid, as a result of a widget being dragged to a new location. Possibly as a result of float being set to true.

A really frustrating bug and results in odd Grid layouts.

Your environment

VueJS3 gridstack.js - 10.1.2

Steps to reproduce

Enable float true. Allow for dragable widgets A grid with 4 columns. Add 3 widgets onto the grid. Adding each to x0,y0. Change events happen as expected for each added widget and any affected widgets. Use the update api to move the bottom widget (x0, y2) to the middle (x0, y1) - again this creates the change event as expected. Now drag widget currently at the bottom (x0, y2) to the middle without dragging directly up (that seems to work). So drag from (x0, y2) -> (x1, y2) -> (x1, y1) -> (x0, y1). This does not result in a change event. Playing with dragging the bottom widget around you will find that on odd occasions it just does not get called.

Expected behavior

The completion of the drag should always result in a change event. For the item dragged and any affected grid items as a result of the drag.

adumesny commented 1 month ago

please post a simple html example showing the issue (as bug report REQUIRE), not instruction for me to create.

adholland commented 1 month ago

Hi @adumesny. Thanks again for the prompt response.

Attempted the recreate the issue in a simple html and couldn't, spent a while working out why I couldn't reproduce the issue.

Went back to my code, respun the vite dev server and cleared the browser cache and all seems ok. No idea what happened there.

So will close this one.

Thank you