Thanks to visit codestin.com
Credit goes to github.com

Skip to content

destroy(false) requires staticGrid: false to reinitialize resize/drag properly #1764

Closed
@periapsistech

Description

@periapsistech

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

  1. Initialize grid using default constructor (or anything really)
  2. Destroy the grid using grid.destroy(false)
  3. Reinitialize the grid using the default constructor (which assumes staticGrid: false)
  4. Drag/Resize will no longer work
  5. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions