We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GanttControl - GranttGrid

Hi,

Do you know if it's possible to resize automaticly Gantt grid colum.
I try with GanttTreeColumn object from GanttGrid element, but this solution doesn't work.

An other question, I don't find exemple for sort GanttGrid element. Do you know if sort on grid colum is possible for GanttControl.

Thank 
Y. Bulourde

3 Replies

RA Rachel A Syncfusion Team November 18, 2015 06:21 AM UTC

Hi Yoann,

Thanks for contacting Syncfusion support.

Query1: How to resize the columns automatically in GanttGrid?

We can  resize the columns by dragging the columns in the GanttGrid(by dragging grid header) or setting the width for the columns like the following code example,

[C#]

        private void Gantt_Loaded(object sender, RoutedEventArgs e)

        {

            Gantt.GanttGrid.Model.ColumnWidths[1] = 200;
        }



Query2: How to sort the columns in GanttGrid?

We can sort the column in GanttGrid by setting the AllowSort property as true as shown in the below code snippet. This property will sort the columns when you click on the column header.


[C#]

       private void Gantt_Loaded(object sender, RoutedEventArgs e)

        {

            Gantt.GanttGrid.AllowSort = true;
        }


Regards,
Rachel.A



SF syncfusion fan August 19, 2019 09:03 PM UTC

How can enable this if the Gantt is not visible on load?  The GanttGrid is alwasy null then.


            Gantt.GanttGrid.AllowSort = true;


VR Vignesh Ramesh Syncfusion Team August 20, 2019 02:18 PM UTC

Hi JJ Brantingham, 

Greetings from Syncfusion Support. 

We have achieved your requirement by enabling GanttGrid’s AllowSort in GanttControl’s TemplateApplied event. Please find the snippet as below. 

[C#] 
public MainWindow() 
{ 
    InitializeComponent(); 
    this.Gantt.TemplateApplied += Gantt_TemplateApplied; 
}

private void Gantt_TemplateApplied(object sender, Syncfusion.Windows.Controls.Gantt.TemplateAppliedEventArgs args) 
{ 
    if (this.Gantt.GanttGrid != null && !this.Gantt.GanttGrid.AllowSort) 
    { 
        this.Gantt.GanttGrid.AllowSort = true; 
    } 
} 

Please find the sample from the below link 

Please let us know if you have any other queries. 

Regards, 
Vignesh. 


Loader.
Up arrow icon