0
votes

I am implementing the kendo Grid drag and drop functionality by using this reference www.jsfiddle.net/JBeQn/

Everything is working fine but when I do drag and drop and on drop event I am getting error of dest is undefined I am not sure why this happening I am using latest version of kendo and jQuery.

grid.table.kendoDropTarget({
group: "gridGroup",
drop: function(e) {        
    e.draggable.hint.hide();
    var target = dataSource.getByUid($(e.draggable.currentTarget).data("uid")),
        dest = $(document.elementFromPoint(e.clientX, e.clientY));

    if (dest.is("th")) {
        return;
    }       
    dest = dataSource.getByUid(dest.parent().data("uid"));

    //not on same item
    if (target.get("id") !== dest.get("id")) {
        //reorder the items
        var tmp = target.get("position");
        target.set("position", dest.get("position"));
        dest.set("position", tmp);

        dataSource.sort({ field: "position", dir: "asc" });
    }                
}

});

Any help will be really appreciated

1

1 Answers

1
votes

dest was null because the method of getByUid wants unique data-uid which created dynamically by kendo grid.

And you can see the code

dest.parent()

Make sure dest.parent should reach to the tr element where further dest.parent().data("uid") will read UID from tr

Hope this will help to others