views:

72

answers:

1

Related to my SO issue at http://stackoverflow.com/questions/3010996/dojo-extending-dojo-dnd-source-move-not-happening-ideas/3012518#3012518 I am now almost done.

I have a dnd.Source derived class - we can consider it a dnd.Source for now, that has within it a node that has a specific class.

    function declare_mockupSmartDndUl(){
    dojo.require("dojo.dnd.Source");
    dojo.provide("mockup.SmartDndUl");
    dojo.declare("mockup.SmartDndUl", dojo.dnd.Source, {
        markupFactory: function(params, node){
            //params._skipStartup = true;
            return new mockup.SmartDndUl(node, params);
        },
        onDropExternal: function(source, nodes, copy){
            console.debug('onDropExternal called...');  

            // dojo.destroy(this.getAllNodes().query(".dndInstructions"));
            this.inherited(arguments);

            var x = source.getAllNodes().length;
            if( x == 0 ){
                newnode = document.createElement('li');
                newnode.innerHTML = "Hello!";
                dojo.addClass(newnode,"dndInstructions");
                source.node.appendChild(newnode);
            }

            return true;
            // return dojo.dnd.Source.prototype.onDropExternal.call(this, source, nodes, copy);
        }   
    });
}

You can see the place I mean from the dojo.destroy that is commented out because it was totally n00b :)

If I do this var y = this.getAllNodes().query(".dndInstructions") the nodelist in y absolutely does contain the node.

Now I need t kill it, nuke it - get it out of there. Out of the dnd.Source, out of the DOM... gone.

Any ideas how to do it safely? It will be the ONLY node in the list at the time we do whatever it is we are goign to do to kill the thing.

Thanks!

+1  A: 

For posterity: this question was answered here: http://article.gmane.org/gmane.comp.web.dojo.user/46395

Eugene Lazutkin
Indeed! THanks!
Soulhuntre