Skip to content

Adding widget to nested grid: Cannot set property 'isOutOfGrid' of undefined #1143

Closed

Description

@ronvanpol

In the situation where you have nested grid where both the parent grid as well as the nested grid accept widgets, adding a widget to the nest grid will result in a javascript error: Cannot set property 'isOutOfGrid' of undefined. It seems that both grids try to handle adding the new widget, while only one is able to accept the widget.

gridstack-error

I have prepared a jsfiddle: https://jsfiddle.net/ncfyau6j/1/

My temp solution was to alter the gridstack.js code. I have added the following check at the start of the function "onDrag":

    if (!draggingElement.is(self.opts.acceptWidgets)) return;

A similar check was added to the event handlers for "drop", "dropover" and "dropout":

    if (!$(ui.draggable).is(self.opts.acceptWidgets)) return;

Activity

  1. adumesny commented on Feb 11, 2020

    @adumesny
    Member

    thank you for reporting and fixing it. keep in mind that acceptWidgets can also be true|false|string so you will have to check being a string before checking the class match.

    Do you mind doing a pull request ?

    I will need to revert my last changes for jquery and move that into a branch (I have a lot of local work for 1.0.0 release with breaking changes I need to put in that branch as well) as I should release a 0.6.4 before with your fixes. I'll be doing that this weekend.

  2. ronvanpol commented on Feb 14, 2020

    @ronvanpol
    Author

    I have created a pull request. First time I've done that, so I hope that it's ok what I did.

  3. added a commit that references this issue on Feb 16, 2020
  4. ronvanpol commented on Feb 16, 2020

    @ronvanpol
    Author

    I just created a new PR against the develop branche. Hopefully everything is ok this time.

  5. adumesny commented on Feb 17, 2020

    @adumesny
    Member

    fixed in the next release - thanks for reporting and code suggestion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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