Skip to content
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

grid doesnt deactivate droppable properly when using acceptWidgets #542

Closed
nelsonad opened this issue Oct 19, 2016 · 18 comments
Closed

grid doesnt deactivate droppable properly when using acceptWidgets #542

nelsonad opened this issue Oct 19, 2016 · 18 comments

Comments

@nelsonad
Copy link

I have an issue when adding multiple external items via drag and drop. The first draggable item works well, the grid activates and shows the placeholder and moves existing nodes out of the way.

The problem is with subsequent items, the grid doesn't activate immediately like the first item. It will start working if the new dragged item is moved out and triggers the draggable dropout event.

I tracked it down to an issue with gridstack preventing droppable from calling deactivate after the item is dropped.

And I fixed it by changing gridstacks droppable accept function to check node._temporary

Before:

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);
   }
})

After:

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

mandys commented May 17, 2017

Faced the same issue.
However, fix mentioned by you is no longer working.

When I try and drag it outside the bounds of the grid, dropout gets triggered and I can drag/drop in the grid again nicely.

Without that, I get stuck and error is thrown.

@mandys
Copy link

mandys commented May 17, 2017

@nelsonad - forgot to tag you.

@petegibbins
Copy link

Looks like I'm experiencing the same thing - dragging a widget off a flyout menu into the gridstack, works the first time but not the second time. Unless you drag the widget right to the top of the screen, in this case it's under the top menu.
Will this one get fixed?

@nelsonad
Copy link
Author

nelsonad commented Sep 1, 2017

@petegibbins did you try making the change i posted above? It's still working for me

@petegibbins
Copy link

@nelsonad Hi - yep tried that but no luck for me. I'm using v1 of the framework, could you be using an older version where this works? See that @mandys says it's "no longer" working.

@nelsonad
Copy link
Author

nelsonad commented Sep 1, 2017

@petegibbins oh, ya maybe that's it, i'm using v0.3.0 =/

@petegibbins
Copy link

petegibbins commented Sep 1, 2017

@nelsonad Tried on v0.3.0 still no dice unfortunately. The 'dropover' event does not get fired 2nd time around.

This line always returns undefined on the 2nd drag / drop.
var node = el.data('_gridstack_node');

@AaronRobson
Copy link

I have the same issue, do we know in which revision the workaround stopped working?

@lauantai
Copy link

lauantai commented Apr 4, 2018

Same issue...

@radiolips
Copy link
Member

I thought this had been fixed in a merged PR on v1. @petegibbins you're using the newest version in the develop branch and still having this problem?

@benjamincfaustino
Copy link

benjamincfaustino commented Apr 17, 2018

Same Issue.

Please fix this issue. Thanks

@radiolips

@polenginlabu
Copy link

Same issue please fix thanks!

@radiolips
Copy link
Member

This is working for me on v0.4.0, released yesterday. I'm seeing it work fine on the demo - http://gridstackjs.com/demo/two.html - I'm closing the ticket, but if someone has a specific problem, please let me know.

@jun1432
Copy link

jun1432 commented Sep 18, 2018

I'm still experiencing this one see #940 every after dragstop and try adding a new widget on a flyout menu it triggers and error " Uncaught TypeError: Cannot set property '_grid of undefined" line 933 "node._grid = self; "

@mishrarajesh
Copy link

This is working for me on v0.4.0, released yesterday. I'm seeing it work fine on the demo - http://gridstackjs.com/demo/two.html - I'm closing the ticket, but if someone has a specific problem, please let me know.

I am still experiencing this issue in v0.4.0

@stefan2595
Copy link

@mishrarajesh @jun1432 @polenginlabu @benjamincfaustino
The fix for me was:
jquery/jquery-ui@2228050

@LaxmanTelang
Copy link

I am still facing this issue added below code :
this.dd
.droppable(self.container, {
accept: function(el) {
el = $(el);
var node = el.data('_gridstack_node');
if (node && !node._temporary && node._grid === self) {
return false;
}
return el.is(self.opts.acceptWidgets === true ? '.grid-stack-item' : self.opts.acceptWidgets);
}
})

Still not working for me . Please suggets me what to do now

@adumesny
Copy link
Member

@LaxmanTelang can you provide a jsfidle sample showing the issue with latest code ?
use https://jsfiddle.net/adumesny/jqhkry7g as starting point.

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

No branches or pull requests