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

GanttView column resizes when scrolling

2 Answers 48 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 04 Mar 2020, 11:52 PM

We have a GanttView being used to display data over time, with a column on the left displaying a name associated with each row of data. Upon first rendering a data set onto the GanttView, the name column automatically sizes itself to fit the longest name in the data set. This behavior is nice, and we wish to keep it.

However, if the data set is large, not all rows of the data set will be immediately rendered onto the GanttView; these rows will only be rendered when the GanttView is scrolled down to reveal them. A result of this is that the name column will resize itself to fit the names of newly-rendered rows, if their names are longer than the longest name initially rendered.

This causes an issue for us, as we have functionality that makes use of the width of the name column, and we cannot rely on the GanttView being scrolled down to ensure that the name column is at its final width.

Is there a way to force the GanttView to size the name column to fit the longest name, regardless of whether that name's row has already been rendered?

Or, alternatively, is there a way to force the GanttView to render all of its rows when it is populated with data? I understand that this may cause a significant decrease in performance, but this may be acceptable.

2 Answers, 1 is accepted

Sort by
0
Accepted
Vladimir Stoyanov
Telerik team
answered on 09 Mar 2020, 11:36 AM

Hello Alexander,

Thank you for the provided information. 

Speaking generally, the cells in the column will be measured when the corresponding row is scrolled into view. With this in mind, you can use the Scrolling service in order to make sure that control has scrolled to the desired row. 

Alternatively, you can also measure the RadGanttView with a big enough size to fit all of the rows (which might lead to a poorer peformance):

this.GanttView.Measure(new Size(2000, 2000));

I hope you find this helpful. Let me know, if I can be of any further assistance. 

Regards,
Vladimir Stoyanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Alexander
Top achievements
Rank 1
answered on 09 Mar 2020, 05:37 PM

Hello Vladimir,

Thank you for your reply. Your suggestion of measuring the GanttView to a size large enough to contain all of the rows worked for us. We used the number of tasks to calculate the ideal height of the GanttView, and then passed that height along with the GanttView's own width into Measure(). There is a slight decrease in performance, but for this part of our program I believe this is acceptable.

Tags
GanttView
Asked by
Alexander
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Alexander
Top achievements
Rank 1
Share this question
or