Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Error thrown on drag start #71

Closed
mparisi76 opened this issue Dec 4, 2013 · 8 comments
Closed

Error thrown on drag start #71

mparisi76 opened this issue Dec 4, 2013 · 8 comments
Labels

Comments

@mparisi76
Copy link

Hi guys, I've been struggling with trying to come up with a sortable implementation that works with ng-repeat. The re-ordering of indexes after a drag/drop never seems to be right. I've just tried your solution, which I thought was promising, however, as soon as I attempt to drag an element I get this error:

TypeError: 'undefined' is not a function (evaluating 'placeholder.element().attr('class')')

I don't have placeholder set in the options, however placeholder.element() is valid.

What am I doing wrong?

I am using angular v1.2.0-rc.3, jQuery UI v1.9.2, and jQuery v1.9.1

@thgreasi
Copy link
Contributor

thgreasi commented Dec 5, 2013

This seem interestig...
Can you provide a jsfiddle demonstrating your use case and instructions to reproduce the error?

Also:

  • why are you still using angular 1.2rc? I suggest you to update, since (the last time I checked) the version is 1.2.3, containing lots of changes.
  • ensure you are using the latest version of the angular1.2 branch of this lib. Some changes were includes last weekend.

@mparisi76
Copy link
Author

I have updated as per your suggestion and the sorting is still wonky.

I will come up with a jfiddle in a few.

Thanks.

@thgreasi
Copy link
Contributor

thgreasi commented Dec 6, 2013

I just pushed an extra commit #74 to test if placeholder.element is a function.
Hope it helps. If not, we will figure it out as soon you have the fiddle.

@mparisi76
Copy link
Author

I'm actually not getting the placeholder error any more. What happens now, is that as I drag images from right to left, after a while, when I drop the image, they all get re-ordered and end up in the wrong positions. I'm going to work on the fiddle today.

Thanks.

@mparisi76
Copy link
Author

Hey Thodoris, I have created a jsfiddle that shows the re-order issue. The sortable being used is from: cdnjs.cloudflare.com/ajax/libs/angular-ui/0.4.0/angular-ui.min.js. I'm guessing that this is the incorrect version. I'm not sure how to use the sortable.js for angular 1.2 in the jsfiddle, although I do use that one in my code. I thought maybe you could adjust the jsfiddle appropriately. Let me know what you find.

http://jsfiddle.net/DWVhY/5/

Thanks!

@thgreasi
Copy link
Contributor

There seems to be an issue with the placeholder detection that we use and jquery 1.9.x.
It looks like that the placeholder.element() method was undocumented before 1.10.x.......
Here is my changed fiddle. I had to use jQuery 1.10 for this to work.

@thgreasi
Copy link
Contributor

Here is a fiddle that seems to work with jquery ui 1.9.x.
Please test with your use case and reopen this issue if necessary.

@mparisi76
Copy link
Author

This seems to be working now. I will keep my eye on it. Thanks!

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

No branches or pull requests

2 participants