在dijit / Tree上拖放(dnd)在IE8上无法正常工作

时间:2014-03-27 16:12:55

标签: internet-explorer-8 drag-and-drop tree dojo

我用dijit / tree / dndSource创建了一个简单的dijit / Tree作为dndController。 dnd适用于除IE8之外的所有浏览器。

require([
"dijit/tree/ObjectStoreModel",
"dijit/Tree",
"dojo/store/Memory",
"dojo/store/Observable",
"dijit/tree/dndSource"], function (ObjectStoreModel, Tree, Memory, Observable, dndSource) {

var myStore = Observable(Memory({
    data: [{
        name: 'root',
        id: 'root'
    }, 
        {
            name: 'level1',
            id: 'level1',
            parent: 'root'
        }, {
            name: 'level2',
            id: 'level2',
            parent: 'root'
        }, {
            name: 'level3',
            id: 'level3',
            parent: 'root'
        },
            {
                name: 'level31',
                id: 'level31',
                parent: 'level3'
            }, {
                name: 'level32',
                id: 'level32',
                parent: 'level3'
            }, {
                name: 'level33',
                id: 'level33',
                parent: 'level3'
            }, 
                {
                    name: 'level331',
                    id: 'level331',
                    parent: 'level33'
                }


    ],
    getChildren: function (object) {
        return this.query({
            parent: object.id
        });
    },
    put: function (p1, p2) {
        p1.parent = p2.parent.id;
    }
}));


var myModel = new ObjectStoreModel({
    store: myStore,
    getRoot: function (onItem) {
        onItem(myStore.get("root"));
    },

    mayHaveChildren: function (item) {
        var items = myStore.query({
            parent: item.id
        });
        return items.length > 0;
    }
});





var myTree = new Tree({
    model: myModel,
    openOnClick: true,
    dndController: dndSource
}, "treeDiv");

myTree.startup(); 
});

结帐这个小提琴并尝试多次点击不同的节点:http://jsfiddle.net/Bu9zv/21/

0 个答案:

没有答案