0

Wish if someone could give me a solution to make kendo grid auto scroll when dragging a TreeView element up or down.

Shivanka
  • 723
  • 2
  • 8
  • 21
  • Can you elaborate your issue? – Rodney Hickman Jan 07 '13 at 20:07
  • I have a Kendo TreeView applied to a div. when user tries to drag and drop elements to the TreeView, if the Tree has expanded beyond the visible area it should auto scroll/ navigate based on the mouse direction. – Shivanka Jan 09 '13 at 04:57

1 Answers1

2

Attach a drag event handler to the treeview, and set the scrollTop of the element that is scrollable depending on the drag position.

for example if the treeViewHolderDivEdit (below) is your container of the treeview you can do below.

treeview.bind("drag", function (e) {

     var targetDataItem =  treeview.dataItem(e.dropTarget);
     if(targetDataItem != null || targetDataItem != undefined)
     {
             if(targetDataItem.text == "Root" && e.statusClass == "insert-top")
             {
             e.setStatusClass("k-denied");
             }
            //  $("#status").html(e.statusClass + "  "+targetDataItem.text );
     }
       var y = e.pageY - $("#treeViewHolderDivEdit").offset().top;
       $("#treeViewHolderDivEdit").scrollTop(y);

 });
Hrishi
  • 350
  • 3
  • 12