Description
Subject of the issue
When destroying a grid using grid.destroy(false)
you must specify the staticGrid
option during reinitialization. Calling destroy(false)
should not overwrite the grid's options and use the defaults as depicted in the documentation.
Your environment
- gridstack.js v4.2.3, HTML5
- Chrome, Windows 10
Steps to reproduce
- Initialize grid using default constructor (or anything really)
- Destroy the grid using
grid.destroy(false)
- Reinitialize the grid using the default constructor (which assumes
staticGrid: false
) - Drag/Resize will no longer work
- Execute
grid.setStatic(false)
, drag/resize works again
I was able to reproduce this using the 'demo1' example as well.
See fiddle:
https://jsfiddle.net/u35pmjLd/
Expected behavior
Calling destroy(false)
then init()
should keep the default options/functionality. In this case, staticGrid
should be set to false. This will continue to allow grid items to be resizable and draggable.
Actual behavior
After destroying a grid and reinitializing with the default constructor, the grid becomes static and prevents drag/resize actions on the grid items requiring either an API call to grid.setStatic(false)
or adding a redundant staticGrid: false
to the initializer options.
Happy to supply more info!
P.S. This was supposedly resolved in this PR:
#1209