Skip to content

fix nested grids with different acceptWidgets class #1150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 17, 2020
Merged

fix nested grids with different acceptWidgets class #1150

merged 1 commit into from
Feb 17, 2020

Conversation

adumesny
Copy link
Member

@adumesny adumesny commented Feb 17, 2020

Description

this.dd
  .droppable(self.container, {
    accept: function(el) {
      el = $(el);
      var node = el.data('_gridstack_node');
      if (node && node._grid === self) {
        return false;
      }
      return el.is(self.opts.acceptWidgets === true ? '.grid-stack-item' : self.opts.acceptWidgets);
    }
  })

the problem was that dropover|dropout|drop handlers did NOT return false (was handled) so the parent grid was getting the bubbled event, causing error

Checklist

  • Created tests which fail without the change (if possible)
  • All tests passing (yarn test)
  • Extended the README / documentation, if necessary

* fix for #1143
* added sample test where parent and nested grid have different drop class support
* while this.dd.droppable.accept() does check for
el.is(self.opts.acceptWidgets === true ? '.grid-stack-item' : self.opts.acceptWidgets)
to prevent wrong items from being dropped, the problem was that `dropover|dropout|drop` handlers did NOT return false so the parent grid was
getting them as well, causing error
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 68.146% when pulling 5aae305 on adumesny:develop into b30655d on gridstack:develop.

@adumesny adumesny merged commit 3211512 into gridstack:develop Feb 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants