This is a migrated thread and some comments may be shown as answers.

Dynamic resize of Gantt

5 Answers 140 Views
Gantt
This is a migrated thread and some comments may be shown as answers.
Sam
Top achievements
Rank 1
Sam asked on 29 Oct 2014, 05:15 PM
Just curious if anyone has figured a way to dynamically resize the Gannt chart on the client side. I've tried resizing the entire div container but it looks like I'd have to do every container inside the main div. Is there an easier way?

5 Answers, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 30 Oct 2014, 08:01 AM
Hi,

The Gantt control has a complex layout, where the inner containers have their sizes set depending on the available space determined by the outer container. This is all done in javascript. So in order to properly resize the control you have to:
1. Set the size to the outermost container:
$telerik.$($find("RadGantt1").get_element()).width(1000)
2. Call the resize() method of the _widget object
$find("RadGantt1").resize()


Regards,
Bozhidar
Telerik
0
Sam
Top achievements
Rank 1
answered on 30 Oct 2014, 11:00 AM
Well it looks like that works for the outer borders and toolbar but the timeline view doesn't resize correctly. Sometimes it overflows outside the border, and sometimes it doesn't fill it up. See attached screen shots. 
0
Sam
Top achievements
Rank 1
answered on 30 Oct 2014, 11:07 AM
Bozhidar, sorry, but I'm actually getting an error calling the resize() function 

"undefined is not a function"

0
Bozhidar
Telerik team
answered on 30 Oct 2014, 01:35 PM
Hi,

Please excuse me. There's a type-o in the code sample I sent you. It should be:
$find("RadGantt1")._widget.resize()


Regards,
Bozhidar
Telerik
0
Sam
Top achievements
Rank 1
answered on 30 Oct 2014, 01:50 PM
That worked perfectly. Thanks. 
Tags
Gantt
Asked by
Sam
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Sam
Top achievements
Rank 1
Share this question
or