You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to drop an external element into a droppable grid stack item but i can not do that because gridstack also accept that element and move other grid stack items to make room for the new widget
Your environment
version of gridstack.js: 0.4.0
which browser and its version: Google Chrome 69.0.3497.100
Steps to reproduce
Initialize gridstack with options acceptWidgets: '.grid-stack-item'
Create a side bar contain items which have class .side-bar-item
Using jQueryUI to make grid stack items droppable, which accept .side-bar-item as draggable element
Drag a side bar item into a grid stack item
grid stack items are moved down to make room for new widget so that I can not drop side bar item into the grid stack item
Setting acceptWidgets: false fixed the issue, but I also want to add new widget from outside by dragging it into the grid.
I think this issue is because drop event does not stop propagation, so everytime i drag an element into grid stack item, the event also move up to parent grid container and causing the grid to handle this element
I tried to fix the issue by using greedy option and calling stopPropagation() from drop event, but it does not work.
The text was updated successfully, but these errors were encountered:
ghost
changed the title
acceptWidgets option does not work
acceptWidgets option does not work when setting grid stack item droppable
Oct 18, 2018
if you are tying to drop the green box only inside the red boxes (assuming they are nested grids), you can do that with latest 0.6.4 code - see example https://gridstackjs.com/demo/nested.html
Your test code overrides the grip droppable to accept the green item...
if you are trying to created nested grids on the fly, but still able to add to the top grid a well, then it's a dup of #1009.
closing this, please re-open if I misunderstood and you can show a simpler example with latest code.
First of all, thanks for the great library!
Subject of issue
I want to drop an external element into a droppable grid stack item but i can not do that because gridstack also accept that element and move other grid stack items to make room for the new widget
Your environment
Steps to reproduce
Initialize gridstack with options
acceptWidgets: '.grid-stack-item'
Create a side bar contain items which have class
.side-bar-item
Using
jQueryUI
to make grid stack items droppable, which accept.side-bar-item
as draggable elementDrag a side bar item into a grid stack item
Here is demo.
Expected behaviour
Grid should not accept side bar item
Actual behaviour
grid stack items are moved down to make room for new widget so that I can not drop side bar item into the grid stack item
Setting
acceptWidgets: false
fixed the issue, but I also want to add new widget from outside by dragging it into the grid.I think this issue is because drop event does not stop propagation, so everytime i drag an element into grid stack item, the event also move up to parent grid container and causing the grid to handle this element
I tried to fix the issue by using
greedy
option and callingstopPropagation()
from drop event, but it does not work.The text was updated successfully, but these errors were encountered: