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

How to disable draging of disabled node of tree view

1 Answer 391 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
ianc
Top achievements
Rank 1
ianc asked on 19 Apr 2013, 03:01 PM
I am trying to avoid drag and droping on disabled elements . My tree view definition is:
@(Html.Kendo().TreeView()
        .Name("treeview")
        .DragAndDrop(true)
        .ExpandAll(true)
           .Events(e => e.Drag("...").DragStart("....").Drop("...").Select("..."))
....
 .BindTo(....
               item.Text = x.Name;
               item.Id = x.Id
               item.Enabled = false;
 )
Events do some business logic for elements movement. I was trying to find on DragStart event any information about k-state-disabled class in e.sourceNode but I fail. 
Also I was trying to found any Enabled property in data source element - also did not found anything.
Could someone help with this issue ? Where is my mistake?

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 22 Apr 2013, 02:23 PM
Hi Lukasz,


You are right, that you could get the information about the disabled node through the e.sourceNode property. Here is a sample implementation.
E.g.
function dragStart(e) {
    if ($(e.sourceNode).find(".k-state-disabled").length > 0) {
        e.preventDefault();
    }
}

Please let me know if this approach is working in the current scenario.

 

Regards,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
TreeView
Asked by
ianc
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or