This is a migrated thread and some comments may be shown as answers.

[Solved] e.isValid on NodeDrop?

1 Answer 119 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Derek Hunziker
Top achievements
Rank 1
Derek Hunziker asked on 22 Jul 2010, 07:12 PM
Hello,

I am trying to alert my users before NodeDropped using the NodeDrop client event. It's working great, but I only need to alert when the drop is actually possible (I.E. when the "+" sign indicator appears on the dragged node).

Is there a way to determine if the drop target is valid? It seems as though you guys have already figured it out for the dragged node indicators?

Currently, I am using the following. It works, but I'm wondering if there's a more elegant solution:

function OnNodeDrop(e) {
    if ($('.t-drag-status').hasClass('t-add')) {
       //...
    }
}

Thank you!

-Derek

1 Answer, 1 is accepted

Sort by
0
Accepted
Alex Gyoshev
Telerik team
answered on 28 Jul 2010, 08:48 AM
Hi Derek,

Great suggestion - we just implemented it and it will be available with the official release. If you want to have it right away, replace the isDropPrevented assignment in the onDrop function in telerik.treeview.js with:
var isDropPrevented =
        $t.trigger(this.element, 'nodeDrop', {
            isValid: !$dragClue.find('.t-drag-status').hasClass('t-denied'),
            dropTarget: e.target,
            item: $draggedElement.closest('.t-item')[0]
        });

Your Telerik points have been updated.

Greetings,
Alex Gyoshev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
TreeView
Asked by
Derek Hunziker
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Share this question
or