scrolling while dragging in tree

How to speed up scrolling while item is dragged? Scrolling is a real pain if you have to scroll up a few pages to drag item. Is there any way to scroll to the top at once? Like the “home” key? Or scroll with the right scroll-bar while item is dragged?


>> How to speed up scrolling while item is dragged?


You can make scrolling faster by modification in the dhtmlxtree.js. You can try to increase the step in the _autScroll method: currently this step is 20.


dhtmlXTreeObject.prototype._autoScroll=function(node,a1,a2){
if (this.autoScroll)
{
if (node){
a1=getAbsoluteTop(node);
a2=getAbsoluteTop(this.allTree);
}
//scroll down
if ( (a1-a2-parseInt(this.allTree.scrollTop))>(parseInt(this.allTree.offsetHeight)-50) )
this.allTree.scrollTop=parseInt(this.allTree.scrollTop)+20;
//scroll top
if ( (a1-a2)<(parseInt(this.allTree.scrollTop)+30) )
this.allTree.scrollTop=parseInt(this.allTree.scrollTop)-20;
}
}



>> Is there any way to scroll to the top at once?


You can try to use focusItem(itemId) to set focus at the first item.


tree.focusItem(tree.getItemIdByIndex(rootId,0));

Thanks, the trick with focusItem worked fine for me.