gridstack.js icon indicating copy to clipboard operation
gridstack.js copied to clipboard

Move items between two or more grid-stack containers

Open nnikolay opened this issue 11 years ago • 36 comments

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?

Example: [div class="grid-stack" id="grid-nav-left"][/div] [div class="grid-stack" id="grid-body"][/div] [div class="grid-stack" id="grid-nav-right"][/div]

Thanks! Nik

nnikolay avatar Apr 15 '15 07:04 nnikolay

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

nnikolay avatar Apr 17 '15 08:04 nnikolay

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.

ronvanpol avatar Apr 18 '15 09:04 ronvanpol

Hi guys, just found this thread thanks to me ol' friend Mr.Google. I am looking for the same thing to have 2 containers. The left container will be inactive items, the right side will be an empty container for active. I will like to drag items from the left to the right container to make the item active, and also have an option to simply drag around in that container and re-size each in the active container.

ghost avatar May 29 '15 13:05 ghost

+1

enriquecaballero avatar May 29 '15 19:05 enriquecaballero

:+1:

abologna-r7 avatar May 29 '15 19:05 abologna-r7

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 [email protected] wrote:

[image: :+1:]

— Reply to this email directly or view it on GitHub https://github.com/troolee/gridstack.js/issues/133#issuecomment-106916078 .

alangunning avatar May 29 '15 20:05 alangunning

Could you please elaborate, sir.

enriquecaballero avatar May 29 '15 20:05 enriquecaballero

@alangunning I have trying your solution, but doesn't work for me. Do you have some sample code?

nnikolay avatar May 30 '15 09:05 nnikolay

@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.

enriquecaballero avatar Jun 02 '15 14:06 enriquecaballero

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" [email protected] wrote:

@alangunning https://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 https://github.com/troolee/gridstack.js/issues/133#issuecomment-107983124 .

alangunning avatar Jun 02 '15 16:06 alangunning

@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

alangunning avatar Jun 03 '15 01:06 alangunning

@alangunning Looks good! Is there a way to actually have it animate while I drag from one container to another? With placeholder, etc.

enriquecaballero avatar Jun 03 '15 17:06 enriquecaballero

@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.

nnikolay avatar Jun 04 '15 08:06 nnikolay

@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.

alangunning avatar Jun 04 '15 11:06 alangunning

@alangunning thanks a lot. Your suggestion fixes the issue I mean with the resizing. I have played a bit with your example, but I can not set 2-3 active grids and move items between them. Can you please make an example with 2 or more active grids, where I can move widgets between them? In my case I don't need any inactive grid, only active grids. For example I am trying to build an page builder with elements like: header, body, left and right grid. Is it possible you make a small example? Thanks a lot! Nik

nnikolay avatar Jun 15 '15 10:06 nnikolay

@troolee thank you for the great plugin

@alangunning thanks for the demo, I tried a bit around based on your solution but I always got into trouble when moving an item between the grid-stacks. the item to move became invisible outside the grid-stack origin. Although it was dropped then in the target grid-stack correctly. Did I miss something?

And just in case: does anyone have a solution (or hint) for correctly auto-positioning the item automatically visually when moving around the item in the target grid-stack (before dropping)?

tnmdo avatar Jul 21 '15 21:07 tnmdo

I've moving widgets in and out of nested grids as a way of grouping widgets. We were originally going to use drag-and-drop to move widgets from parent grid to nested grids, but you end up having to chase down your nested grid's widget as it slides out of the way assuming a move. We're opting instead for a global "group widgets" mode as an alternative and distinguished UI apart from drag-and-drop move. Basically: add a group (aka, a nested grid), activate the group for adding/removing widgets, clicking widgets in the group evicts them from the group, clicking widgets outside the group moves them into group, lastly deactivate the "add/remove widgets" mode on the group.

derekm avatar Aug 10 '15 15:08 derekm

Hi all, I 'm new user of the Gridstack, I have the same problem as drag and drop a widget to another grid-stack . Is there a fix of this issue ?

marshmeloo avatar Jan 22 '16 20:01 marshmeloo

@marshmeloo I don't think this library is maintained anymore... I would also love this functionality but, looks like it's not going to happen.

Alchnemesis avatar Feb 05 '16 08:02 Alchnemesis

+1

ghominejad avatar Feb 16 '16 12:02 ghominejad