Multiple tasks on a row - Gantt

2 posts, 1 answers
  1. Tore
    Tore avatar
    13 posts
    Member since:
    Dec 2012

    Posted 14 Feb 2017 Link to this post

    Hello, I am using the Telerik  Kendo UI MVC Gantt control and want to display multiple tasks on one row.

    As far as I know, this is not supported in Gantt control without doing some hacking in css and javascript. 

    What I am currently trying out is to use UnderScore.Js to group my data and then adjust the vertical

    displacement by setting the css top property. I am loading multiple tasks for each employee into the Gantt and 

    I want to get these tasks on one line. In addition, I have to hide the rows that then will not show any data anymore.

    My business requirement is to make the Gantt display more compact.

     

    I am hooking into the OnDataBound client-side event of Gantt control and the code below contains commented code 
    to try to patch the Gantt view. Problem now is that the adjustment does not look good aligned. The data is not aligned well,
    trying to hide the rows in the Gantt control does not help. In addition, the code is way to slow as the jQuery code is far too slow. 

    I got about 4-500 rows in my Gantt control. The javascript code below contains the commented code where I have tried to adjust 
    the Gantt control to support Multiple tasks on a row. 

    Is there any elegant and easy way to do this?

    function onDataBound() {
        //debugger;
      
        var gantt = this;

        // var ganttasks = [];

        // gantt.element.find(".k-task").each(function (e) {
        //     //debugger;
        //     var taskuid = $(this).attr("data-uid");
        //     var dataItem = gantt.dataSource.getByUid(taskuid);
        //     ganttasks.push({ uid: taskuid, ganttask: dataItem });
        // });

        ////underscore js used below
        // var that = this;
        // var gantt = that;
        var ganttdatasource = $("#gantt").data('kendoGantt').dataSource.data();
        _.chain(ganttdatasource).sortBy('EmployeeName').groupBy('PrsPersonId').sortBy('start').each(function (g) {
            var gindxgantt = 0;
            var isBigona = false;
            _.each(g, function (gi) {

                if (gi.PrsPersonId === 9050) {
                    //debugger;
                    isBigona = true;
                }

                //debugger;
                if (_.first(g).uid === gi.uid) {
                    //this is the first row in the group, start a runner indexing variable
                }
                if (_.first(g).uid !== gi.uid) {
                    //This is not the first item, hide the row itself and move task in the gantt up a given set of pixels
                    //debugger;
                    //var ganttselector = "div[data-uid=" + gi.uid + "]:first";

                    //$("[data-uid=" + gi.uid + "][class != k-task]").parent().parent().css("display", "block");
                    //$("[data-uid=" + gi.uid + "][class != k-task]").parent().parent().css("height", "1px");
                    //$("[data-uid=" + gi.uid + "][class != k-task]").parent().parent().first().css("background", "yellow");
                    //$("[data-uid=" + gi.uid + "][class != k-task]").parent().parent().css("padding", "0px");
                    //$("[data-uid=" + gi.uid + "][class != k-task]").parent().parent().css("margin", "0px");

                    //var ganttverticaldisplacement = (-32 * gindxgantt) + "px";
                    //$(ganttselector).css("top", ganttverticaldisplacement);
                    //if (isBigona) {
                    //    $(ganttselector).css("background-color", "red");
                    //}
                    //var ganttrowselector = "tr[data-uid=" + gi.uid + "]";
                    //if (gindxgantt >= 1) {
                    //    $(ganttrowselector).remove();
                    //}
                }
                gindxgantt++;
            });
        });
    }

  2. Answer
    Nencho
    Admin
    Nencho avatar
    1736 posts

    Posted 16 Feb 2017 Link to this post

    Hello Tore,

    Indeed the Gantt widget does not support multiple tasks on the same row. I am afraid that such implementation would be a complex one, especially when a third part software is involved.

    If you wish to benefit from our technical support on this matter, I can suggest our Professional Services, that are specialized in consulting, development assistance and custom feature implementation.

    Regards,
    Nencho
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top