Hello dHTMLX Team,
I’ve been using your product for awhile, and saw a potential out of it, but I’m facing some restrictions with Gantt’s Layout API, and I’m hoping you could help me.
I have a button, say, that will toggle the gantt chart’s visibility “on” or “off”. That said, the Grid should have 100% width (or even a fixed width) and the gantt chart wouldn’t show at all (or set width 1), and when I click it again, it should show the default layout again.
Here are my approaches.
A variable is set to true or false and the gantt chart will show according to its state. I have a default layout following this,
[code] gantt.config.layout = {
css: 'gantt_container',
cols: [
{
width: 700,
min_width: 300,
rows: [
{ view: 'grid', scrollX: 'gridScrollX', scrollY: 'scrollVer', scrollable: true },
{ view: 'scrollbar', id: 'gridScrollX', group: 'horizontal' },
]
},
{
rows: [
{ view: 'timeline', scrollX: 'scrollHor', scrollY: 'scrollVer' },
{ view: 'scrollbar', id: 'scrollHor', group: 'horizontal' },
]
},
{ view: 'scrollbar', id: 'scrollVer' }
]
}
[/code]
And when I click on toggle button, it sets to the following,
[code] gantt.config.layout = {
css: 'gantt_container',
cols: [
{
width: 1200,
min_width: 300,
rows: [
{ view: 'grid', scrollX: 'gridScrollX', scrollY: 'scrollVer', scrollable: true },
{ view: 'scrollbar', id: 'gridScrollX', group: 'horizontal' },
]
},
{
width: 1,
rows: [
{ view: 'timeline', scrollX: 'scrollHor', scrollY: 'scrollVer' },
{ view: 'scrollbar', id: 'scrollHor', group: 'horizontal' },
]
},
{ view: 'scrollbar', id: 'scrollVer' }
]
}[/code]
I’ve tried to rerender it gantt.render() after setting the new layout object but unfortunately this approach doesn’t work.
Another misc tweak I’ve tried is to set width through gantt.config.layout.cols[1].width = 1 and gantt.config.layout.cols[0].width = 1200 respectively and it also doesn’t work.
Last thing I’ve done is set show_charts to true or false and set grid_width. grid_width isn’t re-rendered and chart is hidden, but grid doesn’t set to full width, which is my requirement.
Is there any workaround for this?