When adding new item to Gantt i receive the following error:
Code as follows:
<SfGantt DataSource="@TaskCollection" Height="450px" Width="100%" HighlightWeekends="true"
Toolbar="@(new List<string>(){ "Add", "Edit", "Update", "Delete", "Cancel", "ExpandAll", "CollapseAll","Indent","Outdent"})"
AllowSelection="true" GridLines="Syncfusion.Blazor.Gantt.GridLine.Both" TreeColumnIndex="1"
ProjectStartDate="@ProjectStart" ProjectEndDate="@ProjectEnd">
<GanttTaskFields Id="TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress"
Dependency="Predecessor" ParentID="ParentId"></GanttTaskFields>
<GanttEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" AllowTaskbarEditing="true" ShowDeleteConfirmDialog="true"></GanttEditSettings>
<GanttColumns>
<GanttColumn Field="TaskId" Width="100"></GanttColumn>
<GanttColumn Field="TaskName" HeaderText="Job Name" Width="250"></GanttColumn>
<GanttColumn Field="StartDate" HeaderText="Start Date"></GanttColumn>
<GanttColumn Field="EndDate" HeaderText="End Date"></GanttColumn>
<GanttColumn Field="Duration" HeaderText="Duration"></GanttColumn>
<GanttColumn Field="Progress" HeaderText="Progress"></GanttColumn>
<GanttColumn Field="Predecessor" HeaderText="Dependency"></GanttColumn>
</GanttColumns>
<GanttLabelSettings LeftLabel="TaskName" TValue="ProjectTasks">
</GanttLabelSettings>
<GanttSplitterSettings Position="30%"> </GanttSplitterSettings>
</SfGantt>
}
@code {
public DateTime ProjectStart = new DateTime(2019, 3, 25);
public DateTime ProjectEnd = new DateTime(2019, 7, 28);
public List<ProjectTasks> TaskCollection { get; set; }
bool SpinnerVisible = true;
protected override async Task OnInitializedAsync()
{
TaskCollection = await _db.Get_Project_Tasks();
}
}
----------------------------------------------------------------------------------------------------------------------------
Class Model
namespace DataAccessSQL.Models.Projects
{
public class ProjectTasks
{
public int TaskId { get; set; }
public string TaskName { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public string Duration { get; set; }
public int Progress { get; set; }
public string Predecessor { get; set; }
public int? ParentId { get; set; }
}
}
Hi Monisha, I did some further testing and it appears only to be an issue if there are less than 2 entries in the TaskList. I have amended the sample withy a single entry and when you add new task it errors and all tasks disappear Thanks, Martin