Merge gantt options into one object

Hi team,

is it possible to do something like this?

// gantt.config.xml_date = '%Y-%m-%d'
// gantt.config.smart_rendering = false
// gantt.config.sort = true
// gantt.config.min_column_width = 45
// gantt.config.scale_height = 68
// gantt.config.drag_links = false

const config = {
  xml_date: '%Y-%m-%d',
  smart_rendering: false,
  sort: true,
  min_column_width: 45,
  scale_height: 68,
  drag_links: false,
}

That would be helpful.

I’ve tried to do it but it doesn’t work.

Hello Bartosz,
If you have the Enterprise or Ultimate version, you can create a new Gantt instance and specify the config from an object:

const gantt = Gantt.getGanttInstance({
    plugins:{
        auto_scheduling: true,
    },
    container: "gantt_here",
    config: {
      xml_date: '%Y-%m-%d',
      smart_rendering: false,
      sort: true,
      min_column_width: 45,
      scale_height: 68,
      drag_links: false,
    },
})

https://docs.dhtmlx.com/gantt/desktop__multiple_gantts.html#ganttinstanceconfiguration

Another way is to iterate the properties of a variable and modify the gantt.config object.
Here is an example:

for(var property in config){
  gantt.config[property] = config[property]
}	

http://snippet.dhtmlx.com/5/9e7f63374