Skip to content

Nested grid removed from Widget when updating contents #2384

@akosfekete

Description

@akosfekete

Subject of the issue

When I update a widget with a nested grid using update(els: GridStackElement, opt: GridStackWidget), and provide content in the opt parameter, the nested grid is also removed (even though the subGridOpts field is not present in the opt parameter).

Your environment

  • version of gridstack.js: tried on 8.3.0-dev, 8.3.0, 8.2.3, 7.3.0
  • which browser/OS: Firefox / Chrome, Linux / Windows

Steps to reproduce

  • Create a nested grid
  • Call update() on it with an opt parameter like this: {content: '<div>some content</div>'}
  • JSFiddle: https://jsfiddle.net/1yr8ngju/

firefox_jpo6N51YpN

Expected behavior

The nested grid should not be removed, only the content that has been set originally when creating the widget.
firefox_GisVZ5Pvqk

I created a fork with a quick "fix": master...akosfekete:gridstack.js:sub-grid-update-issue
I'm not sure if this is intended in some way, but since the documentation says that "Only those set will be updated", I'd epect the nested grid to remain.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions