@page "/ganttchart-features" @using Syncfusion.Blazor.Gantt @using Syncfusion.Blazor.Grids

Gantt Chart



Selected Features:


@code { public SfGantt thisGantt { get; set; } public DateTime ProjectStart = new DateTime(2019, 4, 1); public DateTime ProjectEnd = new DateTime(2019, 5, 4); public DateTime EventDay1 = new DateTime(2019, 4, 17); public List TaskCollection { get; set; } public int DefaultUnitWidth = 33; public int TopTierCount = 1; public int BottomTierCount = 1; TimelineViewMode TopTierUnit = TimelineViewMode.Week; TimelineViewMode BottomTierUnit = TimelineViewMode.Day; string TopTierFormat = "MMM dd, yyyy"; string BottomTierFormat = ""; public string[] Searchfields = new string[] { "TaskId", "TaskName", "StartDate", "EndDate", "Duration", "Progress", "Predecessor" }; protected override void OnInitialized() { this.TaskCollection = GetTaskCollection(); } public class TaskData { 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; } public List SubTasks { get; set; } } private void testMethod(object e) { //var data = (RowSelectEventArgs)e; var data = (TaskbarEditedEventArgs)e; int taskId = data.Data.TaskId; thisGantt.AddRecordAsync(new TaskData() { TaskId = 4, TaskName = "New Added Record", StartDate = new DateTime(2019, 04, 02), Duration = "3", Progress = 50 }, 1, RowPosition.Child); Console.WriteLine(taskId); StateHasChanged(); } public void OnContextMenuClick(ContextMenuClickEventArgs args) { Console.WriteLine(args.ToString()); } public static List GetTaskCollection() { List Tasks = new List() { new TaskData() { TaskId = 1, TaskName = "Foundation", StartDate = new DateTime(2019, 04, 04), EndDate = new DateTime(2019, 04, 21), SubTasks = (new List () { new TaskData() { TaskId = 2, TaskName = "Excavate for foundations", StartDate = new DateTime(2019, 04, 04), Duration = "3", Progress = 30, }, new TaskData() { TaskId = 3, TaskName = "Excavate for foundations", StartDate = new DateTime(2019, 04, 08), Duration = "3", Progress = 30, }, }) } }; return Tasks; } }