This is a migrated thread and some comments may be shown as answers.
Custom Classes on Tasks
1 Answer 32 Views
This is a migrated thread and some comments may be shown as answers.
Kris
Top achievements
Rank 1
Kris asked on 20 Aug 2015, 01:45 AM

Hi,
 I'd like to be able to pass a custom class to the task items in the Gantt component. I know that I could do this by modifying the source once I purchase a professional license, but I'm wondering if there's anything built in. For example, if the data were: 

{
    "ID":7,
    "Title":"Software validation",
    "ParentID":null,
    "OrderID":0,
    "Start":"Date(1401667200000)",
    "End":"Date(1405123200000)",
    "PercentComplete":0.43,
    "Summary":true,
    "Expanded":true,
    "CustomClass": "task-type-1"
}​

Then I'd like to add the "task-type-1" class to either the k-task or k-task-wrap div. This will allow me to easily colour code task types.

Does this functionality already exist, or do I need to modify the source and write it myself?

Thanks for your help!

1 Answer, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 21 Aug 2015, 07:38 AM
Hi Kris,

You could add custom properties to the Gantt Task model, and then map them to the client-side object via the schema configuration of the gantt's dataSource. Here is the implementation of the gantt TaskModel used in our online demos:
public class GanttTaskModel
   {
       public int ID { get; set; }
       public string Title { get; set; }
       public int? ParentID { get; set; }
       public int OrderID { get; set; }
       public DateTime Start { get; set; }
       public DateTime End { get; set; }
       public decimal PercentComplete { get; set; }
       public bool Summary { get; set; }
       public bool Expanded { get; set; }
 
 
       public GanttTask ToEntity()
       {
           return new GanttTask
           {
               ID = ID,
               Title = Title,
               OrderID = OrderID,
               ParentID = ParentID,
               Start = Start,
               End = End,
               PercentComplete = PercentComplete,
               Summary = Summary,
               Expanded = Expanded
           };
       }
   }


Regards,
Dimitar Terziev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Gantt
Asked by
Kris
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Share this question
or