Dynamic date format in grid?


#1

Is it possible to change gantt.config.date_grid after using gantt.init() without using gantt.init() again?

I would like to let my users change the date format in the grid as they wish.

UPDATE:
After some additional research, my question is:
How can I let my user change the date format in the grid let’s say by clicking on a button?
e.g. Between EU and US format.
I’ve tried calling these before/after setting gantt.config.date_grid to the correct format:
gantt.destructor();
gantt.clearAll();
gantt.render();
gantt.refreshData();
using gantt.init() and gantt.parse() again

But nothing seems to update the UI :frowning:


#2

Hello Subri,
If you want to change the date format in the grid after Gantt is loaded, you need to also change the grid_date_format template:
https://docs.dhtmlx.com/gantt/api__gantt_grid_date_format_template.html
Then, you just need to call the render method.

Here is an example:
http://snippet.dhtmlx.com/5/c5b60bb36


#3

Thank you, it works nicely!