question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Drag between two sortables

See original GitHub issue

I’m having problem moving items between two different zones. It is possible to move item from one to another, but then new drag has to be initiated to sort in the new location.

Btw is it somehow possible to drag item to empty zone?

Live example - http://fluid.cz/projects/react-dnd/

function _moveWidget(e){
    var overComponent = e.overComponent.props
    var draggedComponent = e.draggedComponent.props

    var draggedComponentObj = _.find(_page.zones[draggedComponent.zoneKey].widgets, {'id':draggedComponent.widgetData.id}) 
    var overComponentObj = _.find(_page.zones[overComponent.zoneKey].widgets, {'id':overComponent.widgetData.id}) 

    draggedIndex = _page.zones[draggedComponent.zoneKey].widgets.indexOf(draggedComponentObj);
    overIndex = _page.zones[overComponent.zoneKey].widgets.indexOf(overComponentObj);

    _page.zones[draggedComponent.zoneKey].widgets.splice(draggedIndex,1)
    _page.zones[overComponent.zoneKey].widgets.splice(overIndex, 0, draggedComponentObj)
}

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
ntdbcommented, May 20, 2015

Hey @gaearon, has the isDragging problem been addressed? I just upgraded to 1.0.0, rewired everything for the new API, and isDragging still seems to be wrong after a component is dragged to a new list.

I asked too soon but will leave this here for anyone else who stumbles upon this issue. Define a custom isDragging method on your DragSource as described here. Thanks @gaearon for the excellent library!

0reactions
gaearoncommented, May 20, 2015

@ntdb Thanks for using it! Yeah, isDragging is the way to go.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sortable drag and drop across two lists (trying to follow the ...
I am trying to find a good implementation of the drag and drop across multiple lists, and I found the one on this...
Read more >
Drag from sortable to sortable - jQuery Forum
When rows are dragged between the sections of Table Sortable 1, then the same row (copy) is added to Table Sortable 2, and...
Read more >
How to create sortable Drag and Drop with vanilla Javascript
In this video you will learn:How to create sortable Drag and Drop with vanilla JavascriptDemo URL: ...
Read more >
Sortable | jQuery UI
Enable a group of DOM elements to be sortable. Click on and drag an element to a new spot within the list, and...
Read more >
Drag and drop between 2 divs with JQuery's draggable
I want to be able to drag and drop divs between other divs in the container. ... $("<div class=\"main_block row text-center ui-sortable-handle ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found