How To refresh on window resize

I want to refresh chart width on windows resize, because i want 100% width this is my css

#gantt
{
min-width: 400px;
width: 100%;
margin: 0 auto;
position:absolute;
height:400px;
}

thanks

I’ve tried this and the gantt grid stays the same width with space around it?

I can grow the parent div but the gantt doesn’t resize. Any ideas?

I use:
style = “position: fixed; bottom: 10px; right: 10px; height: 140px; left: 10px;”

% - This is not exactly

After changing the size of html container, call

grid.setSizes();

to adjust gantt to the new container size.

I use the above method to resize the gantt chart and additionally I do gantt.render()
and it works.

However when

  1. I start from a small window and
  2. I drag the window to make it larger in width and
  3. the resizing happens with the vertical scrollbar in visible state, then

an extra empty cell is displayed at the end of the gantt_task_scale


So my data are truncated from the left with no reason. If I go to the initial width from where I started to widen the screen the problem disappears.


Do you have any suggestions?

Can you share a demo link, where the issue can be checked?

Hello,

I am attaching an example.
You can start from a small browser screen and then (as long as the vertical scrollbar is visible)
when you enlarge the width of the browser window, you will notice that on the left a small portion
of task data are being truncated

Thank you in advance,

E.

DHTMLX Example.zip (241 KB)

Hi,

I can partially confirm the issue. When switching from the state without vertical scroll to state with vertical scroll. The x-scroll state will not be adjusted and as result part of last column will be covered by vertical scroll.

Problem doesn’t appear during horizontal resize, though.

We will include fix in the next build of the gatt.

Thanks a lot!

Is there any way we can fix this until the next build of Gantt?
When do you plan to have a new build?

If you have a support subcription, please open a ticket at support.dhtmlx.com

Have you tried a solution like this?

window.onresize = function(){
gantt.render();
};

Hello,

Try using events:
docs.dhtmlx.com/gantt/api__gantt … event.html
docs.dhtmlx.com/gantt/api__gantt … event.html