Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Telerik Kendo Drag and Drop from grid to treeview - getting destination value

I have a kendo grid in my view named "Grid" and I have a treeview named "treeview".

I'm attempting to enable dragging from the Grid to the treeview. I'm able to get the value of the item I'm dragging but I'm unable to get the value of where I'm dropping it (destination).

This is my document.ready()...

var grid = $("#Grid").data("kendoGrid"), treeview = $("#treeview").data("kendoTreeView"), itemUID;
        grid.table.kendoDraggable({
            cursorOffset: {
                top: 5,
                left: 5
            },
            filter: "tbody > tr",
            group: "Grid",
            hint: function (e) {
                itemUID = e.attr(kendo.attr("uid"));
                var z = $(e).find('.ZID');
                itemUID = z.html();
                return $('<div class="k-grid k-widget"><table><tbody><tr>' + e.html() + '</tr></tbody></table></div>');
            }
        });

        treeview.element.kendoDropTarget({
            group: "Grid",
            drop: function (e) {
                console.log(e.draggable);

                // Value of dragged item
                alert("Dragged row 'Id' " + itemUID);

                itemUID = null;
            }
        });

I ended up figuring it out:

var dest = $(e.toElement).text();

Now that I got the target and destination how do I update the treeview with the newly dragged item?

like image 998
Mithrilhall Avatar asked Nov 20 '25 22:11

Mithrilhall


1 Answers

I ended up figuring it out:

var dest = $(e.toElement).text();
like image 104
Mithrilhall Avatar answered Nov 22 '25 12:11

Mithrilhall



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!