webix.ui tree onBeforeDrop ajax

Hello!

I have code on event onBeforeDrop
https://prnt.sc/10u50br

But, his not waiting ajax request, he return true.

How stoped event onBeforeDrop, when wait ajax ??

Tagged:

Comments

  • No solution this problem?

  • Hi,
    do you want to abort DnD if returning false?
    I am using something like this for that, not sure if this helps you:
    I first validate the DnD operation, then if it passes, manually do tree.Add:

    //* validates the operation
    webix.ajax().get('/search/getValidateDnD/' + paramid).then(function (data) {
    if (data.json().result != "valid") {
    webix.message({
    expire: 5000,
    type: "error", text: data.json().errormsg // "One or more selected nodes are already included in current Product tree."
    });
    return false;
    }
    //* manually add the item to the tree
    var newId = toTree.add({
    ...});

    Also, in some cases if the post called in .add fails I manually remove the add item
    this is in tree.save:
    return webix.ajax().post(postNodeAdd, update, {
    error: function (text, data, XmlHttpRequest) {
    //* the node has been added using tree.add method, so
    //* it needs to be removed
    treeB.remove(id);
    },

    Regards,

  • "do you want to abort DnD if returning false?" - Yes

    I have two tree A and B
    https://prnt.sc/110qfvi

    When I drag and drop from B to A there should be validation through the ajax request. So need to check before drop, that is, on the onBeforeDrop event. But onBeforeDrop doesn't wait ajax request and return True, me need abort DnD(return false) or return true on ajax answer.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion