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

When nested sortable, the oldIndex is overridden by the parent sortable index #363

Closed
mparpaillon opened this issue Apr 23, 2015 · 12 comments

Comments

@mparpaillon
Copy link

Hi,

When dragging an element, the function _onTapStart is called twice. Once for the nested sortable and once for the parent. Because of this, the oldIndex is overridden by the one of the parent.

Hope I'm clear enough.

To reproduce, just create a nested sortable and console.log the oldIndex after setting it in _onTapStart. You'll see it's called twice when sorting the nested sortable.

Thanks a lot

@tplaner
Copy link

tplaner commented Apr 23, 2015

I believe this is related to #331.

I was able to fix it by adding evt.stopPropagation(); at the top of the _onTapStart function (around line 241/242).

I've been using the code without any negative effects for about a week now, I was planning on submitting a pull request after I tested it a little bit more.

@mparpaillon
Copy link
Author

Thanks for the trick. I'll do that :)

Hope it will be fixed soon

@mparpaillon
Copy link
Author

It looks like I have the same issue with 'from' and 'to‘. I've added some console.log in the _dispatchEvent to see what was happening with fromEl and rootEl and it seems that they are overridden too :(

I'm trying to move a block from a column to another (still with my nested sortable)

Any other trick in your hat @tplaner ? ^^

Thx

@tplaner
Copy link

tplaner commented Apr 25, 2015

Can you post a jsbin or jsfiddle with an example? I don't think I'm experiencing that issue.

@mparpaillon
Copy link
Author

Here is my jsfiddle: http://jsfiddle.net/yLo4aLdq/3/

You can open up your console. Move a block from a zone to another and see that the "target" property has the same value as the "from" property.

Thanks

@mparpaillon
Copy link
Author

Yop any idea guys ? I'll look into it myself... but I'm not sure I can do much

@nathanhood
Copy link

Thanks @tplaner, your recommendation was very helpful. I was curious if you have made a pull request yet as you mentioned you were planning on doing.

@LucioFranco
Copy link

Any news on this? I am having the same issue.

tplaner added a commit to tplaner/Sortable that referenced this issue Aug 18, 2015
@RubaXa
Copy link
Collaborator

RubaXa commented Sep 9, 2015

Fixed, try dev-branch.

@RubaXa RubaXa closed this as completed Sep 9, 2015
@LucioFranco
Copy link

@RubaXa Thanks!!

@LucioFranco
Copy link

@RubaXa do you know when this fix will be on master and on npm?

@RubaXa
Copy link
Collaborator

RubaXa commented Sep 9, 2015

After 2-3 weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants