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

Drag boundaries #70

Open
MadTomT opened this issue Oct 1, 2016 · 5 comments
Open

Drag boundaries #70

MadTomT opened this issue Oct 1, 2016 · 5 comments

Comments

@MadTomT
Copy link

MadTomT commented Oct 1, 2016

Hi
Is it possible to set a drag boundary ?
So you can't drag past that boundary?

Thanks

@isocra
Copy link
Owner

isocra commented Oct 1, 2016

No this isn't possible at the moment.

You could provide an onDrop method and see if the mouse is out of the boundary and not allow the drop if so. I think that's the only approach at the moment.

@MadTomT
Copy link
Author

MadTomT commented Oct 1, 2016

Thanks for the reply. I'm using an onDrop to update various values within the row, but I've not been able to get it to stop the drop when its above the area.. how do I get it to stop dropping and what happens to the row ? does it return to it's original position ? Thanks

@MadTomT
Copy link
Author

MadTomT commented Oct 1, 2016

in my onDrop I've added:

if (group.attr('id') === undefined) {
   $('#' + row.id).insertAfter('#lastGroup');
}

This isn't working. I can see row.id = 3 and I've used insertAfter with in other pages, so I'm stuck as to why this doesn't work..

Any ideas ?

@isocra
Copy link
Owner

isocra commented Oct 1, 2016

You're right. I've just had a play and it isn't possible to prevent dropping in onDrop. Looking through the code (I'm afraid it's been a while), I think you have to call insertBefore. I seem to remember that inserting table rows was tricky and didn't work quite the way that you might expect.

Another approach might be to add the "nodrop" class to the rows you don't want it to be dropped onto? You could potentially do this dynamically in the onDragStart?

If that's no good, then I suggest you put a breakpoint on the insertBefore lines and examine the parent object. This should give you what you need to tweak the code above so that it works as you'd like.

Hope this helps!

@MadTomT
Copy link
Author

MadTomT commented Oct 3, 2016

Thanks I seem to have go this working. All my rows have unique ID's, So I'm finding my top rows ID, and the returning false if the ID of the currentRow === the top ID.

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

2 participants