GanttView column resizes when scrolling

3 posts, 1 answers
  1. Alexander
    Alexander avatar
    8 posts
    Member since:
    Sep 2018

    Posted 04 Mar Link to this post

    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. Answer
    Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    705 posts

    Posted 09 Mar Link to this post

    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.
  3. Alexander
    Alexander avatar
    8 posts
    Member since:
    Sep 2018

    Posted 09 Mar in reply to Vladimir Stoyanov Link to this post

    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.

Back to Top