Scrollbar is not working properly in Tree view

Hi I am using this tree view GoJS Tree View

I am getting issue in this even my tree is collapse but still scroll-bar is working.
When the tree is closed and scroll up the mouse in that case tree will move up and down and i tried to apply and override this functionality by my css on div but it is still not working
.Because it talking scrollbar from library and i checked these two property
allowHorizontalScroll: true,
allowVerticalScroll: true,
if i set false then i am unable to apply csss can you guide me??

I want to add scroll bar only when tree length will be greater than div.


You should not be applying any CSS to elements within the Diagram’s HTMLDivElement. That is likely to mess up the Diagram’s implementation of scrollbars.

When I run that TreeView sample and collapse and/or zoom out enough so that all visible nodes are seen within the viewport, I do not see any scrollbar. Isn’t that what you want?

You can check even here GoJS Tree View

  • Please collapse whole tree like below

  • After that please scroll up or down you mouse. Or you can press down arrow key or up arrow key

  • You can see in the above image tree is collapse but when you scroll or press arrow-down or up scrolling is working.
    When a tree is close, there is no point in moving the tree.

I don’t want this above feature.

I want the tree to stay in place when tree is close or tree length will be less then div it should not move.
Please advise me on how to resolve this problem.

That’s what the Diagram.contentAlignment property is for. Try setting it to go.Spot.TopLeft or go.Spot.Top, depending on where you want it to be aligned relative to the viewport.