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

Can't drag item to the end of the list right after item with children if use draggable handle #75

Open
RomanBurunkov opened this issue Jul 27, 2017 · 8 comments
Labels
Milestone

Comments

@RomanBurunkov
Copy link
Contributor

RomanBurunkov commented Jul 27, 2017

Considering example from demo page: https://ramonsmit.github.io/Nestable2/

Example for 'Draggable Handles'(the last one).

Expected behavior

Drag should work for any position in the list.

Actual behavior

e.g.
I'm not able to drag item14 after item 15 if item 15 expanded.

Steps to reproduce the behavior

  1. Go to https://ramonsmit.github.io/Nestable2/.
  2. Drag item 14.
  3. Try to drop it right after Item 15 to the end of the list.

Tried in latest FF and Chrome.
But it works fine if don't use additional draggable handle.

@pjona
Copy link
Collaborator

pjona commented Jul 31, 2017

You are right, but I have this some for all examples. The tip is to move item 14 first to item 15 as a children and then put it as a last item. Can you try?

Alt Text

@RomanBurunkov
Copy link
Contributor Author

RomanBurunkov commented Jul 31, 2017

Sure, I've found this aproach too, but it looks like just a workaround.

@RomanBurunkov
Copy link
Contributor Author

RomanBurunkov commented Jul 31, 2017

And let's imagine that item14 has children and you have max level of children set to two.

@RomanBurunkov
Copy link
Contributor Author

I've meant this situation:
{ maxDepth : 2 }

nest_spl

And you are not able to drag 51_Pink....right after Barco-s... and there is no workaround which works ;)

@pjona pjona added the bug label Jul 31, 2017
@pjona pjona added this to the 1.6.0 milestone Jul 31, 2017
@ekomsctr
Copy link

I think i found the problem there... In the code of the dragMove function it seeks for the .dd-item under the pointer, might it be that your content completely cover that element? You can test it like i did for myself: try to add a padding to the .dd-item element and see if it still does it, it worked as a quickfix for me in the wait for an official fix.

@pjona pjona modified the milestones: 1.6.0, 1.7.0 Oct 25, 2017
@RomanBurunkov
Copy link
Contributor Author

RomanBurunkov commented Oct 26, 2017

@ekomsctr, thanks you found that.
I'm going to check whether this can help me to resolve this issue.

@RomanBurunkov
Copy link
Contributor Author

This hint also can fix the issue:

//var before = e.pageY < (this.pointEl.offset().top + this.pointEl.height() / 2);
var before = e.pageY < (this.pointEl.offset().top + this.pointEl.find('div:first-child').height() / 2);

@RomanBurunkov
Copy link
Contributor Author

So, in this case, the reason probably is the variable 'before' is always 'true' and we can't place element after the .dd-item node.

May be it is possible to add some conditions to place placeEl to the bottom of the list if we out of the bottom border of the rootlist...

@pjona , What do you think about that?

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

No branches or pull requests

3 participants