jsGanttImproved / ng-gantt

Gantt for Angular 8 based on jsgantt-improved
MIT License
61 stars 28 forks source link

ScrollTo only working on initial load #18

Closed handyhollis closed 4 years ago

handyhollis commented 4 years ago

If i set the data and options inside ngOnInit, everything works fine. If i call a webservice and populate the data in a subscribe, the data updates the chart but the scrollto has no effect. I have explicitly set the data in the subscribe to make sure its not a data issue.

ngOnInit() {

this.projectsObservable = this.projectService.getProjectPlans(0);
this.projectsObservable.subscribe(projects => { this.data = [{example data goes here}]

    this.editorOptions = {
        vFormat: 'month',
        vScrollTo: '2019-01-01',
    }

} Im guessing the scroll has already run before teh data has loaded. Is there anyway to force the scroll to run again after the data has loaded?

mariohmol commented 4 years ago

try to call this.editor.setOptions(this.editorOptions); after the data and options

is this feature working on vanilla js gannt?

https://github.com/jsGanttImproved/jsgantt-improved

handyhollis commented 4 years ago

Ok, thank you. Will try it as soon as I get back to the office. I believe it's vanilla jsganttimproved

handyhollis commented 4 years ago

Thank you very much. It works perfectly. Wish I'd asked 6 hours earlier :-)