Skip to content

onDrop called at page load #128

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

Closed
DumboJet opened this issue Sep 23, 2014 · 4 comments
Closed

onDrop called at page load #128

DumboJet opened this issue Sep 23, 2014 · 4 comments

Comments

@DumboJet
Copy link

The onDrop method is called when the page loads for every item that has is defined.
This doesn't make sense to me.

An example of using it without arrays and doing ALL handling in event handlers like onDrop would be appreciated.

Also, I get this error:

 TypeError: Cannot set property 'jqyoui_pos' of undefined
     at angular.module.service.mutateDroppable (http://localhost:2014/Scripts/Angularjs/Libraries/AngularDragDrop/angular-dragdrop.js:179:67)
     at null.<anonymous> (http://localhost:2014/Scripts/Angularjs/Libraries/AngularDragDrop/angular-dragdrop.js:110:18)
     at val (http://localhost:2014/Scripts/angular.js:1049:18)
     at http://localhost:2014/Scripts/angular.js:14158:28
     at completeOutstandingRequest (http://localhost:2014/Scripts/angular.js:4337:10)
     at http://localhost:2014/Scripts/angular.js:4638:7 

Probably because I try to use it with empty arrays as model (I want to use only the onDrag event and get information from inside there on what was dragged where. Is this possible?).

UPDATE: Using an empty object for model prevents the above error and the data that I want seem to be inside the arguments. :)

@DumboJet
Copy link
Author

I have a new issue:
After drop is finished my drop target has a "z-index: 9999;" and stays on top.
I am using it with a helper if that matters.

@DumboJet
Copy link
Author

OK! Here is the fix for the previous problem (in this.move()):

  $fromEl.css({'position': 'absolute', 'z-index': zIndex})
    .css(fromPos)
    .animate(toPos, duration, function() {
      // Angular v1.2 uses ng-hide to hide an element
      // and as we remove it above, we've to put it back to
      // hide the element (while swapping) if it was hidden already
      // because we remove the display:none in this.invokeDrop()
      if (hadNgHideCls) $toEl.addClass('ng-hide');
      if (callback) callback();
      $fromEl.css('z-index', 'auto'); // <------------------------- Fix
  });

Please apply this fix. :)

codef0rmer pushed a commit that referenced this issue Oct 1, 2014
  - Closes #125, #121, #99 - Fix paradox of choice ($ vs jQuery)
  - Closes #122 - Update jQueryUI depedency in demos and tests
  - Closes #130 - Restore display value if set, else use block
  - Closes #128, #36, #30 - Restore zIndex value always
  - Closes #117, #110 - Fix destroying widgets prior to initialization
  - Closes #111 - Allow dropping without ngModel similar to dragging
@ericpeters0n
Copy link

For those that come later, 'placeholder:true' can apparently cause the

TypeError: Cannot set property 'jqyoui_pos' of undefined

under certain conditions..

@adeel-raza
Copy link

@ericpeters0n Thanks a lot that was exactly the case for me.

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

3 participants