Search code examples
javascriptjqueryjqxwidgets

Unable to assign a item a second one


i have a strange behavior on assigning a item a second time.

Starting situation: I have a jqxTree with several items like this:

- apple
- oracle
- microsoft

I drag and drop one item in another like this:

-apple
|-microsoft
-oracle

That works fine. Now I want that the item (microsoft) would be copied and the copy should be assigned to apple and the original remains in its original position.

I have implemented the following (simple modified from the sample code ‘drag and drop’ http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxtree/index.htm#demos/jqxtree/dragdrop.htm ):

$('#treeA').jqxTree({ allowDrag: true, allowDrop: true, height: '300px', width: '220px', 
        dragEnd: function (item, dropItem, args, dropPosition, tree) {
            $('#treeA').jqxTree('addTo', dropItem, item, true);
            return false;
        }
    });

Until then it works but if i drag the microsoft item a second time, the value item is null.

Any suggestions? Thanks in advance.

EDIT 1:

jsFiddle working example:

http://jsfiddle.net/mtcj7v5r/


Solution

  • Ok, i have asked this question in the forum from the developer too and i got the following answer:

    Hello,

    Unfortunately, such implementation is not supported by jqxTree because calling addTo in the dragEnd callback interferes with the proper rendering of the widget.

    Best Regards, Dimitar

    jQWidgets team http://www.jqwidgets.com/