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

Grid-stack horizontal swap

Open sailajachellu opened this issue 8 years ago • 3 comments

Horizontal swap in 2*2 is bringing controls down

gridstack version: 0.3.0

  1. Created 2*2 grid stack: first row: 1 2 second row: 3 4 this.serializedData = [ { x: 0, y: 0, width: 6, height: 3 }, { x: 6, y: 0, width: 6, height: 3}, { x: 0, y: 3, width: 6, height: 3 }, { x: 6, y: 3, width: 6, height: 3} ];
  2. I have disabled resizable as that is not required to me
  3. Dragging 1 to 3 or 3 to 1 or 2 to 4 or 4 to 2 is working as expected (Vertical swapping is happening)
  4. But Dragging 1 to 2 is moving 2 and 4 down below 1 and is increasing container height and making it 3 rows with first row to be 1 second row 3, 2 and third row 4.

Expected behaviour

Horizontal swapping should work like 3 and 4 should be swapped without any increase in height or moving widgets down

Actual behaviour

But Dragging 1 to 2 is moving 2 and 4 down below 1 and is increasing container height and making it 3 rows with first row to be 1 second row 3, 2 and third row 4

Attachment

Please find drag.html file in the attachment

Note: I have read in this website only that this horizontal gridstack.js-master.zip swap is not possible. Can you please help in resolving the issue or confirm me whether this can be done or not.

Thanks, Sailaja.

sailajachellu avatar Jan 24 '18 06:01 sailajachellu

Hi, @sailajachellu ! Horizontal swaps aren't currently possible, but are on the roadmap. There are several open tickets for this already, so I'm closing this ticket. To answer your question succinctly: there is no current way to achieve this, but that'll be rectified in a future release.

radiolips avatar Feb 12 '18 15:02 radiolips

Hi @radiolips ! Are there any updates on this issue? Thank you!

veroena avatar Jul 22 '22 12:07 veroena

@veroena radiolips is no longer involved in this lib - I have rewritten the collision and nodes will now (since 4.x) swap horizontally if the same size

adumesny avatar Jul 23 '22 21:07 adumesny