开发者

Kill a node in dojo.dnd.source?

Related to my SO issue at Dojo extending dojo.dnd.Source, move not happening. Ideas? 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!


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜