Custom Classes on Tasks

2 posts, 0 answers
  1. Kris
    Kris avatar
    3 posts
    Member since:
    Aug 2015

    Posted 19 Aug 2015 Link to this post

     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: 

        "Title":"Software validation",
        "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!

  2. Dimitar Terziev
    Dimitar Terziev avatar
    1266 posts

    Posted 21 Aug 2015 Link to this post

    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

    Dimitar Terziev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top