Gantt Control - CreateTaskModel Null Reference

0 Answers 29 Views
Gantt
Abby
Top achievements
Rank 1
Iron
Abby asked on 21 Jan 2025, 01:19 PM

I don't understand what is going on.  I am sure I am missing something obvious.  

 

I am trying to setup my first Gantt Chart.   It is my understanding that this is setup in 2 pieces. The tree and timeline.   I am able to load the tree.  It comes up and I am able to see hierarchy.

 

Example of Tree..

I get data in a hierarchy. I assign Parent Ids to each record. I am ok with this. 

 

What I am struggling with is when I tried to add the GanttViews and it blows. up

 

Here is my initial load... I have not technically loaded any data. So I see the dates and columns all look good. 

 

During the loading of the data I get this error..

 

Clearly I am missing something.  I just don't know what.  

 

The only thing I have added between it loading the Tree and trying to load the timeline is ...


<GanttViews>

    <GanttWeekView></GanttWeekView>
    <GanttMonthView ></GanttMonthView>

</GanttViews>

        

 

Here is how I defined the start of the Gannt Control.

 


    <TelerikGantt Data="ServiceOrderData" 
                   Width="100%" 
                  Height="80vh"
                  ParentIdField="@nameof(ServiceOrder.ParentID)"
                  @ref="ServiceOrderRef"        
                  HasChildrenField=""
                  EnableLoaderContainer="true"
                  IdField="@nameof(ServiceOrder.ServiceOrderPk)"
                  StartField="@nameof(ServiceOrder.ServiceDate)"
                  EndField="@nameof(ServiceOrder.ServiceDate)"
                  TitleField="@nameof(ServiceOrder.WorkType)"
                  OnEdit="@OnEdit"                
                 
                  >

 

 

I clearly did not populate something that the Timeline needs. I am not sure what. It looks like all I need is the Start, End and TItle.  But I have tried different variations of that and it still fails. 

 

I am confused. Any suggestions? 

 

 

 

Hristian Stefanov
Telerik team
commented on 24 Jan 2025, 08:31 AM

Hi Abby,

To resolve the issue with the Gantt Timeline not rendering correctly, let's go through some important checks and suggestions:

Check Data Binding Fields

Ensure that the StartField, EndField, and TitleField are correctly mapped to the properties in your ServiceOrder model. These fields are essential for rendering the Timeline.

Data Initialization

Make sure your ServiceOrderData is properly initialized and populated before the Gantt component attempts to render. If the data is not available at the time of rendering, it can cause errors.

Flat vs. Hierarchical Data

Since your data is hierarchical, ensure that the ParentIdField is correctly set. For flat data, the IdField and ParentIdField are crucial to establish parent-child relationships.

GanttViews Configuration

Ensure that your <GanttViews> configuration is correctly placed within the Gantt component. Double-check for any syntax errors or misplaced tags.

=====

If the issue persists, please provide a runnable reproduction of the problem using dummy data, so I can test and investigate your configuration further on my end. You can share the code with me through the REPL platform.

Kind Regards,

Hristian

No answers yet. Maybe you can help?

Tags
Gantt
Asked by
Abby
Top achievements
Rank 1
Iron
Share this question
or