jQWidgets Forums

jQuery UI Widgets Forums Navigation Tree Tree DragEnd Issue

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 12 years, 5 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Tree DragEnd Issue #12708

    marchip
    Member

    Hi

    i have a tab control with 2 tabs. In each tab there is a tree.

    Each tree retieve data from server (json data). I populate each tree in this way:

    var treeSource =
    {
    localdata: dataEvent,
    datatype: ‘json’
    };
    var dataAdapter2 = new $.jqx.dataAdapter(treeSource);
    dataAdapter2.dataBind();
    var recordss = dataAdapter2.getRecordsHierarchy(‘id’, ‘parentId’, ‘items’, [{ name: ‘text’, map: ‘label’ }, { name: ‘tag’, map: ‘value’}]);
    $(‘#eventStructure’).jqxTree({ source: recordss, allowDrag: true, width: ‘100%’, height: ‘100%’, theme: ‘classic’ });

    Then i would handle dragEnd event of each tree with this code:

    $(“#eventStructure,#treeFunctions”).bind(‘dragEnd’, function (event) {

    if (event.args.label) {
    console.log(event.args.label);
    var ev = event.args.originalEvent;
    var x = ev.pageX;
    var y = ev.pageY;
    if (event.args.originalEvent && event.args.originalEvent.originalEvent && event.args.originalEvent.originalEvent.touches) {
    var touch = event.args.originalEvent.originalEvent.changedTouches[0];
    x = touch.pageX;
    y = touch.pageY;
    }
    var offset = $(“#epl”).offset();
    var width = $(“#epl”).width();
    var height = $(“#epl”).height();
    var right = parseInt(offset.left) + width;
    var bottom = parseInt(offset.top) + height;
    if (x >= parseInt(offset.left) && x <= right) {
    if (y >= parseInt(offset.top) && y <= bottom) {
    //$(“#epl”).val($(“#epl”).val() + ‘ ‘ +event.args.label);
    alert(event.args.label);
    }
    }
    }
    });

     

    The problem is that the event.args.label is wrong: Example : if i start drag from tree A i found in in events.args.label an information of another tree.

     

    How it’s possible?

    I’ve already seen the example of Tree Drag&Drop.

    Tanks

     

    Tree DragEnd Issue #12719

    Peter Stoev
    Keymaster

    Hi marchip,

    You can learn more about the parameters of these events in the jqxTree’s API documentation: jquery-tree-api.htm. We do not find anything wrong in the way it works.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.