new Resource View

Hi, I have tried to prepare a small test like described in the online documentation, but I am not able to get it work.

Here is what I did.

ASPX

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="GanttResourceViewTest._Default" %>
<%@ Register Assembly="Syncfusion.EJ, Version=15.4451.0.17, Culture=neutral, PublicKeyToken=3D67ED1F87D44C89"  Namespace="Syncfusion.JavaScript.Models" TagPrefix="ej" %>



<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">

    <div class="row">
        <ej:gantt id="GanttControlDefault" runat="server" viewtype="ResourceView" enabled="true" allowdraganddrop="true" allowcolumnresize="true" showcolumnchooser="true" allowmultisorting="true"
            resourceidmapping="ResourceId"
            resourceinfomapping="ResourceID"
            taskidmapping="TaskID"></ej:gantt>           
    </div>
 
</asp:Content>

Here my code:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace GanttResourceViewTest
{
    public partial class _Default : Page
    {
        public class TaskDetails
        {
            public int TaskID { get; set; }
            public string TaskName { get; set; }
            public string StartDate { get; set; }
            public string EndDate { get; set; }
            public int Duration { get; set; }
            public string Progress { get; set; }
            public string Priority { get; set; }
            public bool Approved { get; set; }
            public List<TaskDetails> SubTasks { get; set; }
            public List<Object> ResourceID { get; set; }
            public bool IsManual { get; set; }
        }

        public class GanttResources
        {
            public string ResourceName { get; set; }
            public int ResourceId { get; set; }
            public int TeamId { get; set; }
        }
        public List<TaskDetails> GetResourceFlatData()
        {
            List<TaskDetails> data = new List<TaskDetails>()
                {
                new TaskDetails() { TaskID  = 1, TaskName= "Plan timeline", StartDate= "02/06/2017", EndDate = "02/10/2017", Duration= 5, Progress= "50", ResourceID= new List<object>(){1}},
                new TaskDetails() { TaskID= 2, TaskName= "Plan budget", StartDate= "02/13/2017", EndDate= "02/17/2017", Duration= 5, Progress= "50", ResourceID= new List<object>(){1}},
                new TaskDetails() { TaskID= 3, TaskName= "Allocate resources", StartDate= "02/20/2017", EndDate= "02/24/2017", Duration= 5, Progress= "0", ResourceID= new List<object>(){1}},
                };
            return data;
        }
        public List<GanttResources> GetResources()
        {
            List<GanttResources> data = new List<GanttResources>(){
                new GanttResources(){ ResourceId = 1, ResourceName = "Anne Dodsworth" },
                new GanttResources(){ ResourceId = 2, ResourceName = "David William"},
                new GanttResources(){ ResourceId = 3, ResourceName = "Nancy Davolio"},
                };
            return data;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            GanttControlDefault.DataSource = GetResourceFlatData();
            GanttControlDefault.Resources = GetResources();
            GanttControlDefault.DataBind();
        }
    }
}



adding all the necessarry scripts is done with the masterpage.

result is nothing will be shown or an error is poping up of an null exception....

maybe you can prepare a small and simple demo, it would also be great tu update your existing demos by loading the data from a DB and changeing the view by a dropdown or something similar.

I have also uploaded the demo I tried to do.

Cheers
Martin

Attachment: GanttResourceViewTest_a9a350be.zip

5 Replies

SR Suriyaprasanth Ravikumar Syncfusion Team December 6, 2017 12:13 PM UTC

Hi Martin, 
 
As per your requirement we have prepared a demo sample for switching between Resource-View and Project-View in Gantt which is rendered using the same dataSource fetched from SQL database. Please find the sample from the below location. 
Note: We have removed the Bin and Obj folder for some security reason. Hence its necessary to add respective file from the build installed location from your side to run the sample.  
 
Please let us know if you require any other assistance on this.   
 
Regards,   
Suriyaprasanth R.  



MS Martin Sickel December 8, 2017 07:20 AM UTC

Thanks for the example

But I still have some questions

I already figured out that the DataModel is not as flexinle as it was. Example:

        public class GanttData
        {
            public int TaskId { get; set; }
            public string TaskName { get; set; }
            public DateTime StartDate { get; set; } // has to be DateTime
            public DateTime EndDate { get; set; } //has to be DateTime
            public string Progress { get; set; }

If I use a string Datatype for Date resourceview will not load and crash in the end.

Next:
        public class Resources
        {
            public int ResourceId { get; set; }  //has to be int
            public string ResourceName { get; set; }
            public int TeamId { get; set; } //has to be int
            public string Color { get; set; }
        }

if ResourceID is not an int Datatype all task will be shown as unssigned task

will this change in the near future?


I also have the following question if an resource is only working 20% of his time on a task, how could that be shown in the Overview?

thanks

Best regards
Martin



SR Suriyaprasanth Ravikumar Syncfusion Team December 11, 2017 11:13 AM UTC

Hi Martin,  
 
Please find the response below. 
 
Query1: If I use a string Datatype for Date resourceview will not load and crash in the end. 
Query2: if ResourceID is not an int Datatype all task will be shown as unssigned task. 
Answer:   We could not able to reproduce the reported issue in our sample, In Gantt, we can able to render both project-view and Resource-view Gantt by using string/numeric type “resourceId and string/date type “startDate/endDate” values. The reported issue may possible to arise if there is any format/type mismatch between declaration , assign of variable and its type in DB. Please refer the code snippet below. 
[ASPX.CS]  
 
   //.. 
        public class GanttData 
        { 
            //.. 
            public string TaskName { get; set; } 
            public string StartDate { get; set; } 
            public string EndDate { get; set; } 
            public int Progress { get; set; } 
        } 
        public class Resources 
        { 
            public String ResourceId { get; set; } 
            public String ResourceName { get; set; } 
            public int TeamId { get; set; } 
        } 
         
        public List<GanttData> GetTasks() 
        { 
                //.. 
                           while (reader.Read()) 
                            { 
                                GanttData obj = new GanttData(); 
                                 
                                obj.StartDate = Convert.ToDateTime(reader.GetValue(2)).ToString("MM/dd/yyyy"); 
                                obj.EndDate = Convert.ToDateTime(reader.GetValue(3)).ToString("MM/dd/yyyy"); 
                               data.Add(obj); 
                            } 
                            reader.Close(); 
               //.. 
        } 
 
        public List<object> GetResourceInfo(string[] values) 
        { 
            //.. 
            foreach (string value in values) 
            { 
                if (value != "") 
                    Resources.Add(value); 
            } 
            return Resources; 
        } 
 
        public List<Resources> GetResources() 
        { 
            //.. 
                            while (reader.Read()) 
                            { 
                                Resources obj = new Resources(); 
                                obj.ResourceId = (string)reader.GetValue(0); 
                                //.. 
                                data.Add(obj); 
                            } 
                            reader.Close(); 
            //.. 
        } 
 
 
(i.e) Change also in DB. 
 
We have prepared a sample as per your requirement. Please find the sample from the below location. 
Query3: I also have the following question if an resource is only working 20% of his time on a task, how could that be shown in the Overview? 
Answer: In Resource-view Gantt, currently we don’t have support for resource unit . Currently we are working on other promised high priority features, so please revert us the importance of using resource unit in your project, this will help us to consider its importance and log a feature report regarding this. 

Please let us know if you require any other assistance on this.   
 
Regards,   
Suriyaprasanth R.  



MS Martin Sickel December 12, 2017 09:48 AM UTC

Hi Suriyaprasanth

Regarding your answer to respecting the resource-unit as well in Resource-Overview

Actually I am not haveing any project running with it, I am only testing the new feature and was thinking by me how could this archieved, so no high prio for it, but in my opinion it would make sense to have this. So a feature request for it would be pretty cool.

Cheers, take care
Martin


SR Suriyaprasanth Ravikumar Syncfusion Team December 13, 2017 10:05 AM UTC

Hi Martin, 
 
As per your request we have planned to provide support for resource unit in resource-view Gantt. Hence we have logged a feature report on this, it will be implemented and included in any of our upcoming main release. 
 
Regards,  
Suriyaprasanth R  


Loader.
Up arrow icon