GanttView Custom Column Data

Posted by: woeityngmiyoko.wong on 20 August 2020, 11:15 pm EST

    • Post Options:
    • Link

    Posted 20 August 2020, 11:15 pm EST

    Hello,

    I am trying to add a custom field columns in the ganttview.

    And I would like to retrieve the data of custom field from database.

    For the default columns is adding/mapping as following,

    this.c1GanttView1.DataStorage.TasksStorage.Mappings.TaskID.MappingName = "TaskID"
    

    May I know how about for custom field columns?

    Could anyone give some guideline? Thanks in advance.

  • Posted 23 August 2020, 11:33 pm EST

    Hi tyng,

    Use the CustomFields MappingInfo to bind your custom field from the database.

    https://www.grapecity.com/componentone/docs/win/online-ganttview/C1.Win.C1GanttView.4.5.2~C1.GanttView.TasksMappingCollection~CustomFields.html

    You can go through the product sample DataBinding which shows how you can do the same:

    …\Documents\ComponentOne Samples\WinForms\v4.5.2\C1GanttView\CS\DataBinding



    Regards,

    Prabhat Sharma.

  • Posted 24 August 2020, 2:24 am EST

    Hello Prabhat,

    Thanks for your reply.

    I’ve using this method to get the task information, as following

    string queryTask = "SELECT * from tasks where category = '" + cmbCategory.Text + "'  order by notes ";
    MySqlDataAdapter TaskAdapter = new MySqlDataAdapter(queryTask, conn);
    
    
    DataSet task = new DataSet();
    TaskAdapter.Fill(task, "tasks");
    
    //Setting Mappings in TasksStorage
    this.c1GanttView1.DataStorage.TasksStorage.Mappings.CalendarID.MappingName = "CalendarID";
    this.c1GanttView1.DataStorage.TasksStorage.Mappings.ConstraintDate.MappingName = "ConstraintDate";
    this.c1GanttView1.DataStorage.TasksStorage.Mappings.ConstraintType.MappingName = "ConstraintType";
    .
    .
    .
    .
    .
    
    
    c1GanttView1.DataStorage.TasksStorage.DataSource = task.Tables[0];
    

    And, what I have tried to add a custom field, as following

      // Add a custom field column
    C1.Win.C1GanttView.CustomFieldColumn customCol = new C1.Win.C1GanttView.CustomFieldColumn();
    customCol.Caption = "Quantity";
    customCol.DataType = typeof(string);
    customCol.Name = "Quantity";
    customCol.Visible = true;
    c1GanttView1.Columns.Add(customCol);
    
    this.c1GanttView1.DataStorage.TasksStorage.Mappings.CustomFields.MappingName = "Quantity";
    
    

    There is an error showing out. I am not sure whether I am using in the correct method. Could you give me some advice?

  • Posted 25 August 2020, 2:04 am EST

    Hello,

    We are working on this and will get back to you soon with the updates.

    [Internal Tracking ID: 458687]

    Regards,

    Prabhat Sharma.

  • Posted 14 September 2020, 3:05 am EST

    Hi tyng,

    Please find the attached sample which shows how you can bind custom columns with DB in GanttView.

    Regards,

    Prabhat Sharma.

    DataBinding (1).zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels