almende / vis

⚠️ This project is not maintained anymore! Please go to https://github.com/visjs
7.85k stars 1.48k forks source link

scrollTop after Timeline creation #3404

Open AndreAlves10 opened 7 years ago

AndreAlves10 commented 7 years ago

Hello,

I'm creating a timeline that has a large amount of groups. After creating the timeline the vertical scroll bar appears on the bottom, as shown in image below, however (for presentation purposes) I would like to put on top (position 0).

capture

This seems a basic thing to do but I'm having problems achieving it. Can someone help me?

Thank you!

mbroad commented 7 years ago

Can you include the minimal code required to reproduce this issue?

teeena commented 7 years ago

The problem also happened to me without the verticalScroll. I debugged and found this.options.orientation.item was undefined in Core.prototype._updateScrollTop() which causes the scrollTop to be set to the bottom. This wasn't what I was expecting because I set orientation = 'top'. It turned out that I was making a subsequent timeline.setOptions() call with only the maxHeight option that reset the orientation option to undefined (see Core.prototype.setOptions()). I got the scrollTop to display at the top by passing the orientation option along with the maxHeight option in the setOptions() call.

AndreAlves10 commented 7 years ago

Thank you @teeena!

Indeed setting orientation: 'top', sets the scroll bar to the top when defining the timeline options.