Hi

I've a class which creates a lot of droppable icons (folders) and another class that creates some draggable file icons. When I drop one of the files in the folders I want to remove the file icon from the screen. However, doing Element.remove(droppedElement); results in a repeated js error "element has no properties" in protoype line 1588. This continues to occur until I click on another draggable.

A abbreviated version of my folder class looks like this:
======================================

oFolder = Class.create();
oFolder.prototype = {

   initialize: function(folder){
this.folder = folder; // the name of the element to create var options = Object.extend({
             image: "administrator/images/unpublish_f2.png",
             alt: this.folder,
             divClass: 'folder',
             elToAttachTo: 'myFolders',
             siteRoot: '',
             userid: 0
       }, arguments[1] || {});
this.options = options; this.folderDiv = this.createHTML(); $(this.options.elToAttachTo).appendChild(this.folderDiv); this.makeDroppable(); },
     makeDroppable: function(){
this.dropObserver = this.dropImageInFolder.bind(this); Droppables.add(this.folderDiv, { accept: Array('image'), hoverclass: 'drophover', greedy:true, onDrop: this.dropObserver } ); },

    dropImageInFolder: function(droppedElement, lastElement, event){
(code to move file into folder...) //need to stop dragging the element b4 removing it :S Element.remove(droppedElement);
   //this is where the js error occurs
}
}
=====================
I think I have to destroy the draggable before removing its element, but I can't see how I can get a reference to the draggable object from the droppable?

Cheers
Rob
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to