Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Prasanna on Dec 18, 2007 10:15
open dhtmlx forum
how to get the div to auto scroll vertically when a mouse holding a dragged item is reached the bottom of viewport

I have 2 divs, the left div holds the tree navigation, while the right hand div displays the items held in selected node of the tree in the left div. now when going for the drag n drop i.e. select few items from the right div and drag drop to another node. This drag n drop works fine.. but if the mouse pointer has reached the very bottom of the viewport it no longer moves to the next node on the tree as the div does not auto-scroll. I have set this.autoScroll=true but still dont see the scroll happening, am i missing something.
Answer posted by Support on Dec 19, 2007 02:20
>>have set this.autoScroll=true but still dont see the scroll happening
There is no need to set any additional parameters , tree must scroll while d-n-d by default.

>>am i missing something
Please check your tree container tag, if it have "overflow:auto" style - it can cause problem, while showing correct scrollbars, they can't be controlled by tree in such case. Correct container tag must not have overflow css style at all, or have overflow:hidden - in such case tree will generate its own scrollbars when necessary, and will correctly auto-scroll while d-n-d
Answer posted by Prasanna on Dec 19, 2007 16:14

this doesnt help it..

here is the thing.. my treeDiv which embodies the tree does not have any overflow style, however the one layer above it. i.e. mainDiv does contain an overflow,
below is the code layout of the screen

<div id="mainDiv" style="overflow:auto; height:80%">
 <table>
 <tr>
 <td>
  <div id="treeDiv">
  </div>
 </td>
 <td>
  <div id="listDiv">
  </div>
 </td>
</div>

treeDiv is where the tree is created, while listDiv contains the items registered with each node of the tree.
i need to drag selected items from listDiv onto a new node in treeDiv and when doing this.. if i've reached the end of the viewport then it should autoscroll

Answer posted by Support on Dec 20, 2007 02:43
>> if i've reached the end of the viewport then it should autoscroll
Which container you mean by "viewport", if tree has inner scroll ( scroll inside  <div id="treeDiv"> ) - it must auto-scroll correctly.
But if you have scroll on <div id="mainDiv" - it will not be updated while d-n-d operation ( because in placed outside tree - it not affected by process inside tree )

If you have inner scroll and it not work correctly - please provide any kind of sample where problem can be reconstructed ( you can send it directly to support@dhtmlx.com )
Attachments (1)
scrolls.png10.26 Kb