Skip to content

dynamically created nested grid disappeared when dragging out (doesn't restore) #2948

Closed

Description

@jujingyi520

Watch the video https://gridstackjs.com/demo/nested_advanced.html

video_10086.mp4

Activity

  1. adumesny commented on Feb 17, 2025

    @adumesny
    Member

    yep, I see that...

  2. jujingyi520 commented on Feb 17, 2025

    @jujingyi520
    Author

    May I ask when you would like to fix this BUG ^ - ^

  3. adumesny commented on Feb 17, 2025

    @adumesny
    Member

    not high on my priority as I don't use nested grid at work, let alone dynamically nested grids. You can donate if you want it fixed sooner - reach out on slack. thanks.

  4. changed the title [-]nested grid disappeared without a trace[/-] [+]dynamically created nested grid disappeared when dragging out (doesn't restore)[/+] on Feb 17, 2025
  5. jujingyi520 commented on Feb 24, 2025

    @jujingyi520
    Author

    The function "removeAsSubGrid" adds a judgment to ensure that it is not eliminated

      removeAsSubGrid(nodeThatRemoved) {
        if (!nodeThatRemoved._event) {
          return
        }
        const pGrid = this.parentGridNode?.grid
        if (!pGrid) return
        pGrid.batchUpdate()
        pGrid.removeWidget(this.parentGridNode.el, true, true)
        this.engine.nodes.forEach((n) => {
          // migrate any children over and offsetting by our location
          n.x += this.parentGridNode.x
          n.y += this.parentGridNode.y
          pGrid.makeWidget(n.el, n)
        })
        pGrid.batchUpdate(false)
        if (this.parentGridNode) delete this.parentGridNode.subGrid
        delete this.parentGridNode
        // create an artificial event for the original grid now that this one is gone (got a leave, but won't get enter)
        if (nodeThatRemoved) {
          window.setTimeout(() => Utils.simulateMouseEvent(nodeThatRemoved._event, "mouseenter", pGrid.el), 0)
        }
      }
  6. adumesny commented on Feb 24, 2025

    @adumesny
    Member

    why are you closing this when it is not fixed in the lib ? are yu saying the first 2 lines fixes the issue now ?

  7. jujingyi520 commented on Feb 24, 2025

    @jujingyi520
    Author

    Yes.

  8. jujingyi520 commented on Feb 24, 2025

    @jujingyi520
    Author

    Are you still working after 6:00 at night? It is half past ten Beijing time. 😃

  9. adumesny commented on Feb 24, 2025

    @adumesny
    Member

    you can submit a code review and get credit with the fix. thanks.
    and I'm always working :) (weekend for this lib. Sunday night right now)

  10. adumesny commented on Jun 21, 2026

    @adumesny
    Member

    that fix is not correct either. in that video the subgrid was creatde dynamically and I expect to remove it and restore the widget inside ouside

  11. added a commit that references this issue on Jun 22, 2026
    ed2969d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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