Error with showDate

Hi !

I would like the chart area scroll automatically (horizontally) on the current date, on the openning of the page. For this I use :

gantt.showDate(new Date());

But when I put this code before the init (gantt.init(“gantt_here”)), I’ve a blank page (and I don’t have any error the log server) and if I put this after the init, the scroll don’t work.

Have you got an idea of the problem ?

Thank you very much for your help !

Ps: sorry for my bad english :s

Hi,
when gantt renders data, by default it scrolls to the earliest scheduled task, you can disable this behavior with ‘initial_scroll’ config: gantt.config.initial_scroll = false;
docs.dhtmlx.com/gantt/api__gantt … onfig.html

Also, make sure that the time scale is rendered and contains the specified date when you call showDate . I.e. the method should be called after gantt.init, and if you not specify time range using start_date/end_date configs - it should also be called after you load data into gantt - after gantt.parse or on onLoadEnd event

docs.dhtmlx.com/gantt/api__gantt … event.html

It’s ok. Big thanks Aliaksandr !