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
{{ message }}
Repository navigation
Move items between two or more grid-stack containers #133
Hi, I would like to have two or more grid-stack containers and move the items (portlets) between them. How to register this containers, so the portlets can be moved from one to another container? And after that, how can I become the serialized positions for each container?
I'm interested in thuis too. My scenario is that i want to have a toolbar from which users can drag items onto multiple gridstack. Any printers in the right direction would be appreciated.
I just initialized two grids, rather than the random class name for
example '.grid-stack-22113' generated by grid stack I made the class name
an option then initialized each grid with active and inactive class name....
@alangunning Did you actually get it to work? Or were you just writing off the top of your head? Cause your solution doesn't seem to work. However, I'd love to be proved incorrect. So please, it would appreciated if you were to share with us the code you wrote that actually got it to work.
Apologies, I have been very busy in work. I will try code up a demo to
share later today
On Jun 2, 2015 10:57, "Enrique Caballero" notifications@github.com wrote:
@alangunninghttps://github.com/alangunning Did you actually get it to
work? Or were you just writing off the top of your head? Cause your
solution doesn't seem to work. However, I'd love to be proved incorrect. So
please, it would appreciated if you were to share with us the code you
wrote that actually got it to work.
—
Reply to this email directly or view it on GitHub #133 (comment)
.
@alangunning this is great! Many thanks! Can you please take a look at the resizing of an item. For example it is not possible for me to resize the item 2, because it overlaps item 3 and item 3 don't move.
@enriquecaballero I did not implement this functionality as it would require a lot of re-calculations that I did not require for my workflow. I simply allow to drag and drop a widget in order to add to another grid. You can see in my sample code that I set auto_position = true in add widget function so that will use existing gridstack core library to place the widget in any available position.
@nnikolay All active widgets are re-sizing fine in all desktop browsers I've tested. Do you mean that when you extend widget 2 that widget 3 does not move down to next row ? In my example I have limited my grids to 6 rows which is preventing this as the grid is full. If you want it to do that, you will need to remove gridstack option 'height' to remove row limit and also adjust the appropriate css accordingly.
Ok folks, I've finally done this. It has experimental status right now and gonna be it up to 1.0.0 so use it with caution and let me know it you see any issues (with behaviour, events, etc).
It probably has issues with knockout/angular/etc so it needs to be checked.
I'm closing this issue so feel free to open new ones in case of bugs.
Next, we likely to release 0.2.5 as it is right now and all issues you find will be fixed in 0.3.0.
Hi,
Could you please let us know how to enable this experimental option?
I have tested with the following option without any success: acceptWidgets: 'grid-stack-item'.
Actually, I cannot drag out from the grid-stack container.
@alangunning
I have a question about your posted demo with active and inactive widget grids.
How do you get the ID of a single widget?
I want to add content to the widgets, but the <div class"content"> tag adding the content to all widgets.
How can i manage only one widget?
I already using the data-widget-id, but if I am using the id in the template div, the widgets do not change the content.
Could you possibly support drag and drop WITHOUT removing the dragged element from its original parent? In my case I want to have a sidebar that contains element that have to be cloned when dragged onto a grid. Looking at the code, the draggable is simply removed after a clone is made:
var el = $(ui.draggable).clone(false);
el.data('_gridstack_node', node);
$(ui.draggable).remove();
The call to remove the draggable should not occur in my specific case. It should only occur when dragging and dropping from one gridstack to another gridstack but not from my sidebar.
@mandys That feature doesn't exist yet, but I'd be happy to add it to our plans for the future.
So that I'm sure that we'll be satisfying your need - you want the ability to clone a widget rather than move a widget in particular instances. Is this correct?
That is correct @radiolips. I think I found that to be one of the most requested features (across some GitHub tickets). Has anyone written a patch for it yet ? Even if it's not available in the core and there is a patch it would be helpful.
No one has yet written a conditional patch, though a few people have made attempts at alterations.
You can see the near-term plan for gridstack here. It doesn't include this feature and I'm unsure if it'll be available for version 1.0. The changes for 1.0 are necessary for the library to mature, but I agree that there have been many requests for this cloning capability as well.
I'll take a look at reprioritizing some enhancements to see what I can do about getting this readied for you sooner.
Activity
nnikolay commentedon Apr 17, 2015
Hi guys, no one knows about this issue? @troolee do you know how to use it or maybe give me a tipp what to do for this feature?
Thanks
Nik
ronvanpol commentedon Apr 18, 2015
I'm interested in thuis too. My scenario is that i want to have a toolbar from which users can drag items onto multiple gridstack. Any printers in the right direction would be appreciated.
enriquecaballero commentedon May 29, 2015
+1
abologna-r7 commentedon May 29, 2015
👍
alangunning commentedon May 29, 2015
I just initialized two grids, rather than the random class name for
example '.grid-stack-22113' generated by grid stack I made the class name
an option then initialized each grid with active and inactive class name....
On Fri, May 29, 2015 at 3:57 PM, Antonio Bologna notifications@github.com
wrote:
enriquecaballero commentedon May 29, 2015
Could you please elaborate, sir.
nnikolay commentedon May 30, 2015
@alangunning I have trying your solution, but doesn't work for me. Do you have some sample code?
enriquecaballero commentedon Jun 2, 2015
@alangunning Did you actually get it to work? Or were you just writing off the top of your head? Cause your solution doesn't seem to work. However, I'd love to be proved incorrect. So please, it would appreciated if you were to share with us the code you wrote that actually got it to work.
alangunning commentedon Jun 2, 2015
Apologies, I have been very busy in work. I will try code up a demo to
share later today
On Jun 2, 2015 10:57, "Enrique Caballero" notifications@github.com wrote:
alangunning commentedon Jun 3, 2015
@enriquecaballero @nnikolay
I have provided a rough demo of the concept for now.To save time I made my changes in Dev branch of my own fork of this repo. Will contribute back asap or feel free to re-use any of the code.
Demo can be viewed at: http://alangunning.github.io/gridstack.js/demo/multiple-grids.html
enriquecaballero commentedon Jun 3, 2015
@alangunning Looks good! Is there a way to actually have it animate while I drag from one container to another? With placeholder, etc.
nnikolay commentedon Jun 4, 2015
@alangunning this is great! Many thanks! Can you please take a look at the resizing of an item. For example it is not possible for me to resize the item 2, because it overlaps item 3 and item 3 don't move.
alangunning commentedon Jun 4, 2015
@enriquecaballero I did not implement this functionality as it would require a lot of re-calculations that I did not require for my workflow. I simply allow to drag and drop a widget in order to add to another grid. You can see in my sample code that I set auto_position = true in add widget function so that will use existing gridstack core library to place the widget in any available position.
@nnikolay All active widgets are re-sizing fine in all desktop browsers I've tested. Do you mean that when you extend widget 2 that widget 3 does not move down to next row ? In my example I have limited my grids to 6 rows which is preventing this as the grid is full. If you want it to do that, you will need to remove gridstack option 'height' to remove row limit and also adjust the appropriate css accordingly.
15 remaining items
troolee commentedon Mar 1, 2016
Ok folks, I've finally done this. It has experimental status right now and gonna be it up to 1.0.0 so use it with caution and let me know it you see any issues (with behaviour, events, etc).
It probably has issues with knockout/angular/etc so it needs to be checked.
I'm closing this issue so feel free to open new ones in case of bugs.
Next, we likely to release 0.2.5 as it is right now and all issues you find will be fixed in 0.3.0.
Cheers.
marshmeloo commentedon Mar 1, 2016
+1
Coopyrightdmin commentedon Mar 4, 2016
Hi,
Could you please let us know how to enable this experimental option?
I have tested with the following option without any success:
acceptWidgets: 'grid-stack-item'.Actually, I cannot drag out from the grid-stack container.
By the way, thanks for your incredible work!
Cheers.
troolee commentedon Mar 4, 2016
It should be selector
.grid-stack-item. Please check out a demo http://troolee.github.io/gridstack.js/demo/two.htmlg-javi commentedon Jul 6, 2016
@derekm I currently have the same issu, were you able work it out?
griphi commentedon Jul 21, 2016
@alangunning
I have a question about your posted demo with active and inactive widget grids.
How do you get the ID of a single widget?
I want to add content to the widgets, but the <div class"content"> tag adding the content to all widgets.
How can i manage only one widget?
I already using the data-widget-id, but if I am using the id in the template div, the widgets do not change the content.
`
This does not work...
Have anyone an idea?
Thanks
griphi commentedon Jul 26, 2016
Is anyone here?
dharmeshkotadiya commentedon Sep 30, 2016
Can you please any one help me on this?

Thanks in advance!!
ronvanpol commentedon Nov 15, 2016
Could you possibly support drag and drop WITHOUT removing the dragged element from its original parent? In my case I want to have a sidebar that contains element that have to be cloned when dragged onto a grid. Looking at the code, the draggable is simply removed after a clone is made:
var el = $(ui.draggable).clone(false);
el.data('_gridstack_node', node);
$(ui.draggable).remove();
The call to remove the draggable should not occur in my specific case. It should only occur when dragging and dropping from one gridstack to another gridstack but not from my sidebar.
mandys commentedon May 10, 2017
Did anyone find an update to this ? For layout designs once a widget is dragged, it would be helpful if it's not removed from sidebar.
radiolips commentedon May 10, 2017
@mandys That feature doesn't exist yet, but I'd be happy to add it to our plans for the future.
So that I'm sure that we'll be satisfying your need - you want the ability to clone a widget rather than move a widget in particular instances. Is this correct?
mandys commentedon May 10, 2017
That is correct @radiolips. I think I found that to be one of the most requested features (across some GitHub tickets). Has anyone written a patch for it yet ? Even if it's not available in the core and there is a patch it would be helpful.
radiolips commentedon May 10, 2017
No one has yet written a conditional patch, though a few people have made attempts at alterations.
You can see the near-term plan for gridstack here. It doesn't include this feature and I'm unsure if it'll be available for version 1.0. The changes for 1.0 are necessary for the library to mature, but I agree that there have been many requests for this cloning capability as well.
I'll take a look at reprioritizing some enhancements to see what I can do about getting this readied for you sooner.
huangzh123 commentedon Jul 10, 2017
JqueryUI has this function, but it doesn't work here