Jark Monster
Jark Monster

Reputation: 763

Kendo UI TreeView DragEnd event crashes extremely laggy

I'm trying to detect when I have dropped an item in a treeview after dragging it. When I do, it just hangs indefinitely searching for the javascript function. Sometimes it finds it after 10 seconds and sometimes it doesn't. I've verified with Firebug that the function is always loading (and is only loading once).

My Kendo UI version is: 2012.2.913

Thanks in advance for any help or advice.

@(Html.Kendo().TreeView()
.Name("CompanyHierarchy")
.Events(events => events
    .DragEnd("HierarchyDragEnd")
)
.BindTo(Model.Hierarchy as System.Collections.IEnumerable, mappings =>
{
    mappings.For<Models.EnterpriseChildModel>(binding => binding
        .Children(c => c.Children)
        .ItemDataBound((item, c) =>
        {
            item.Text = c.Name;
        })
    );
})
.DragAndDrop(true))

<script type="text/javascript">
function HierarchyDragEnd(e) {
    alert("here");
}</script>

I don't know if it will help but here's a picture of it when it's 'frozen' enter image description here

Upvotes: 1

Views: 688

Answers (1)

Samuel Caillerie
Samuel Caillerie

Reputation: 8275

It seems that there is a bug with Firefox (in Chrome your example works fine) for the dragend event. A workaround is to delay the result in order to let the dragend event being registered correctly like this :

function HierarchyDragEnd(e) {
    setTimeout(function() {
        alert('here');
    }, 100);
}

Upvotes: 2

Related Questions