jQWidgets Forums

jQuery UI Widgets Forums Navigation Tree disable dropping according the type of item

This topic contains 3 replies, has 2 voices, and was last updated by  ivailo 9 years, 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

  • Guill
    Participant

    Hello,

    I have 2 trees :
    -tree1
    -tree2

    In each tree, I have items ; some of them are groups, the others are elements (fields).

    I can move items between trees and reorganize them but :
    -I want to deactivate dropping of elements in elements and groups in elements.
    -Elements can be dropped only in groups or at tree’s root.
    -Groups can’t be dropped in elements but only in groups or at tree’s root.

    How can I do this using events of tree component ?

    See my fiddle here : http://jsfiddle.net/kDPyz/110/

    Thanks you for your help 😉


    ivailo
    Participant

    Hi Guill,

    You can use dragEnd callback to control where an item can be dropped.
    Please look at this demo.
    You can use an array with elements, where dragEnd returns false, and loop through them.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com


    Guill
    Participant

    Hi ilailo,

    I’ve already seen this demo.

    What event I must use and how to implement what I need (groups can’t be dropped in fields and fields can’t be dropped in fields) ?

    There are two dragEnd events :

    $(‘#treeB’).jqxTree({ allowDrag: true, allowDrop: true, height: ‘300px’, width: ‘220px’,
    dragEnd: function (item, dropItem, args, dropPosition, tree) {

    }
    });

    and…

    $(“#treeA, #treeB”).on(‘dragEnd’, function (event) {
    $(“#dragEndLog”).text(“Drag End”);

    });

    Which of these events use and how to test if I can drop ?

    Thanks for your help

    Guil


    ivailo
    Participant

    Hi Guill,

    Use dragEnd callback.

    dragEnd: function (item, dropItem, args, dropPosition, tree) {
                        if (item.label == "Forum")
                            return false;
                    }

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.