dijit.Tree DND betweenThreshold bug, please help!

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

dijit.Tree DND betweenThreshold bug, please help!

AlexG
Hello, community!





When dragging item 1 before item 2, item 1 disappears somewhere, the same happens when dragging item 1 after item 2.

Should I report a bug or there is any workaround?
Here is my code ( Bug can also be seen at http://dojotoolkit.org/reference-guide/1.8/dijit/Tree.html#betweenthreshold ):

var memoryStore = new Memory({
        data: [{ "id": "1", "name": "Root", "parent": null, "directory": true },
                   { "id": "2", "name": "1", "parent": 1, "directory": false },
                   { "id": "3", "name": "2", "parent": 1, "directory": false }],
        getChildren: function (object) {
                return this.query({ parent: object.id });
        }
});

aspect.around(memoryStore, "put", function (originalPut) {
        return function (obj, options) {
                if (options && options.parent) {
                        obj.parent = options.parent.id;
                }
                return originalPut.call(memoryStore, obj, options);
        }
});

var objModel = new ObjectStoreModel({
        store: new Observable(memoryStore),
        query: { id: 1 },
        labelAttr: "name"
});

(new Tree({
        id: "reportsTree",
        model: objModel,
        showRoot: true,
        dndController: dndSource,
        betweenThreshold: 5,
        getIconClass: function (/*dojo.store.Item*/ item, /*Boolean*/ opened) {
                return item.directory ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "dijitLeaf";
        }
})).placeAt(domId).set("selectedItems", 0).startup();