gridstack.js icon indicating copy to clipboard operation
gridstack.js copied to clipboard

removable item was broken when the grid was destroyed and then reinstantiated

Open DigitagDev opened this issue 2 years ago • 5 comments

Subject of the issue

It seems that when you instantiate a new grid, it works correctly. Removing an item from the grid by dropping in the class defined on the grid options works correctly. However, when the .destroy() function is called and then the grid is reinstantiated with different grid options, removing the item stops working.

Sem título

DigitagDev avatar Sep 09 '23 18:09 DigitagDev

please provide a running example to debug this.

adumesny avatar Sep 10 '23 16:09 adumesny

https://jsfiddle.net/bodinho97/ryv48ugL/24/

add itens in the grid then click on the a to destroy and instantiate again

DigitagDev avatar Sep 11 '23 17:09 DigitagDev

would be great if you colored things (like green/yellow) like the demos, and why do you have trash as a grid item and do you even need to remove items to show issue... you can also setTimeout() and call the path showing the issue as to not require all this extra stuff...

adumesny avatar Sep 11 '23 18:09 adumesny

https://jsfiddle.net/bodinho97/ryv48ugL/89/

i have colored things a little, and added like a tutorial in the logs , to show what to do and whats happening, dont know if its possible to do the error like in the seTimeout() because the error happens when the grid-stack-item its being dragget on top of the trash can. trash can its not a grid item anymore.

DigitagDev avatar Sep 13 '23 12:09 DigitagDev

It's not possible to live update the initial options passed to the grid in the current version of Grid-Stack (or at least I don't know how). This includes changing the row value. A workaround is to destroy the grid and then recreate it, passing the new options value.

DigitagDev avatar Sep 13 '23 12:09 DigitagDev

simplifixed demo https://jsfiddle.net/adumesny/t29h07p3/

adumesny avatar Mar 30 '24 21:03 adumesny

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

adumesny avatar Mar 30 '24 23:03 adumesny