Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sortable list does not accept dropping second item using ng-sortable #356

Closed
fieldfoxWim opened this issue Apr 20, 2015 · 7 comments
Closed

Comments

@fieldfoxWim
Copy link

Hi All

First: great project, throws jqueryUI of the table!!

Context:

I need 2 lists of wich you can clone items from 1 list to the other. I made this in AngularJS using ng-sortable on both lists.
Both lists are horizontal lists, using display:inline

Steps to reproduce:

  • dragging first item from list 1 to empty list 2: works ok, item is cloned, list 2 now has 1 item
  • dragging a second item from list 1 to list 2: list 2 does not accept the item from the moment the mouse enters the UL area, but only from the moment it enters the LI area

http://jsbin.com/yunifehafo/3/edit?html,js,output

Extra:

  • I tested this both with the master branch as with the ng-sortable branch
  • dropping the item in list 2, does trigger the onEnd event, but not the onAdd event

Thanks in advance
Wim

@RubaXa
Copy link
Collaborator

RubaXa commented Apr 20, 2015

You incorrectly used ng-repeat.
You need to add track by $index: http://jsbin.com/xisimi/1/edit

@RubaXa RubaXa added the angular label Apr 20, 2015
@fieldfoxWim
Copy link
Author

Thanks For your quick reply, but that does not fix the issue.
When you drag a second item to the "toolbox", it is not cloned when the mouse enters the box (the UL) you have to drag it above an LI or wiggle it around in the UL, untill it is cloned.

When this is not clear, I can make a screen capture.

EXTRA: this behavior occurs only when an item is entering the UL area from the top, not from the bottom

@RubaXa
Copy link
Collaborator

RubaXa commented Apr 20, 2015

Use http://recordit.co/

@fieldfoxWim
Copy link
Author

Thanks for the recordit hint!

Here is my screencapture: http://recordit.co/dDpfIvM23e
It is based on your latest jsbin http://jsbin.com/xisimi/1/edit

System:

  • Windows 8.1 64bit system.

Tested Browsers:

  • Google Chrome Version 42.0.2311.90 m
  • FireFox 37.0.2
  • Internet Explorer 11

Steps shown in the video:

  1. I drag knife into the toolbox: workst as expected
  2. I try to drag hammer into the toolbox: id does not work, even if the icon next to the mouse changes. I it is not sufficient to enter the UL area with the mouse, However it worked in (1)
  3. I drag hammer onto knife, this time hammer gets added
  4. I drag drill onto the toolbox, same problem.
  5. I darg drill onto the toolbox from the bottom, this works as expected, as from the moment the UL area is entered, the item is added.

Thanks for your time!

@RubaXa
Copy link
Collaborator

RubaXa commented Apr 22, 2015

Alas, I have no solution to this problem.

@fieldfoxWim
Copy link
Author

I was able to fix it!

I changed

if ((el.children.length === 0) || (el.children[0] === ghostEl) ||
                    (el === evt.target) && (target = _ghostInBottom(el, evt))
                ) {

to

if ((el.children.length === 0) || (el.children[0] === ghostEl) ||
                    (el === evt.target)
                ) {

I don't know what the && (target = _ghostInBottom(el, evt)) is doing, as removing it solved my problem and did not really break something. Any hints?

thanks

jsanchez034 added a commit to jsanchez034/Sortable that referenced this issue Jul 30, 2015
…f a horizontally layed out drop zone does not add the item
RubaXa added a commit that referenced this issue Jul 30, 2015
#356 Fixing issue of dropping on the right end of horizontally laid out drop zones
RubaXa added a commit that referenced this issue Sep 22, 2015
@RubaXa
Copy link
Collaborator

RubaXa commented Jul 5, 2016

Dear all! ng-sortable.js is moved to the separate repository. If this issue is still actual, please create it there once again and this rojects needs a maintainer:

@RubaXa RubaXa closed this as completed Jul 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants