@@ -14,13 +14,15 @@ A column template is used to customize the column’s look. The following code e
1414N> The column template feature is used to render the customized element value in the UI for a particular column. The data operations like filtering, sorting, etc., will not work based on the column template values. It will be handled based on the values you have provided to the particular column in the datasource.
1515
1616
17- ``` cshtml
17+ {% tabs %}
18+ {% highlight razor tabtitle="Index.razor" %}
19+
1820@using Syncfusion.Blazor.Gantt
1921@using Syncfusion.Blazor.Buttons
2022
2123<SfGantt DataSource =" @TaskCollection " Height =" 450px " Width =" 100% " HighlightWeekends =" true " ProjectStartDate =" @ProjectStart " ProjectEndDate =" @ProjectEnd " >
2224 <GanttColumns>
23- <GanttColumn Field="TaskId " HeaderText="Task ID" MinWidth="150" MaxWidth="250" AllowReordering="false"></GanttColumn>
25+ <GanttColumn Field="TaskID " HeaderText="Task ID" MinWidth="150" MaxWidth="250" AllowReordering="false"></GanttColumn>
2426 <GanttColumn Field="TaskName" HeaderText="Task Name">
2527 <Template>
2628 @{
@@ -33,7 +35,7 @@ N> The column template feature is used to render the customized element value in
3335 </GanttColumn>
3436 <GanttColumn Field="Duration" HeaderText="Duration"></GanttColumn>
3537 </GanttColumns>
36- <GanttTaskFields Id="TaskId " Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId ">
38+ <GanttTaskFields Id="TaskID " Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentID ">
3739 </GanttTaskFields>
3840</SfGantt >
3941
@@ -49,30 +51,32 @@ N> The column template feature is used to render the customized element value in
4951
5052 public class TaskData
5153 {
52- public int TaskId { get; set; }
54+ public int TaskID { get; set; }
5355 public string TaskName { get; set; }
5456 public DateTime? StartDate { get; set; }
5557 public DateTime? EndDate { get; set; }
5658 public string Duration { get; set; }
5759 public int Progress { get; set; }
58- public int? ParentId { get; set; }
60+ public int? ParentID { get; set; }
5961 }
6062
6163 public static List<TaskData> GetTaskCollection()
6264 {
6365 List<TaskData> Tasks = new List<TaskData>() {
64- new TaskData() { TaskId = 1, TaskName = "Project initiation", StartDate = new DateTime(2022, 04, 05), EndDate = new DateTime(2022, 04, 21) },
65- new TaskData() { TaskId = 2, TaskName = "Identify Site location", StartDate = new DateTime(2022, 04, 05), Duration = "0", Progress = 30, ParentId = 1 },
66- new TaskData() { TaskId = 3, TaskName = "Perform soil test", StartDate = new DateTime(2022, 04, 05), Duration = "4", Progress = 40, ParentId = 1 },
67- new TaskData() { TaskId = 4, TaskName = "Soil test approval", StartDate = new DateTime(2022, 04, 05), Duration = "0", Progress = 30, ParentId = 1 },
68- new TaskData() { TaskId = 5, TaskName = "Project estimation", StartDate = new DateTime(2022, 04, 06), EndDate = new DateTime(2022, 04, 21) },
69- new TaskData() { TaskId = 6, TaskName = "Develop floor plan for estimation", StartDate = new DateTime(2022, 04, 06), Duration = "3", Progress = 30, ParentId = 5 },
70- new TaskData() { TaskId = 7, TaskName = "List materials", StartDate = new DateTime(2022, 04, 06), Duration = "3", Progress = 40, ParentId = 5 },
71- new TaskData() { TaskId = 8, TaskName = "Estimation approval", StartDate = new DateTime(2022, 04, 06), Duration = "0", Progress = 30, ParentId = 5 }
66+ new TaskData() { TaskID = 1, TaskName = "Project initiation", StartDate = new DateTime(2022, 04, 05), EndDate = new DateTime(2022, 04, 21) },
67+ new TaskData() { TaskID = 2, TaskName = "Identify Site location", StartDate = new DateTime(2022, 04, 05), Duration = "0", Progress = 30, ParentID = 1 },
68+ new TaskData() { TaskID = 3, TaskName = "Perform soil test", StartDate = new DateTime(2022, 04, 05), Duration = "4", Progress = 40, ParentID = 1 },
69+ new TaskData() { TaskID = 4, TaskName = "Soil test approval", StartDate = new DateTime(2022, 04, 05), Duration = "0", Progress = 30, ParentID = 1 },
70+ new TaskData() { TaskID = 5, TaskName = "Project estimation", StartDate = new DateTime(2022, 04, 06), EndDate = new DateTime(2022, 04, 21) },
71+ new TaskData() { TaskID = 6, TaskName = "Develop floor plan for estimation", StartDate = new DateTime(2022, 04, 06), Duration = "3", Progress = 30, ParentID = 5 },
72+ new TaskData() { TaskID = 7, TaskName = "List materials", StartDate = new DateTime(2022, 04, 06), Duration = "3", Progress = 40, ParentID = 5 },
73+ new TaskData() { TaskID = 8, TaskName = "Estimation approval", StartDate = new DateTime(2022, 04, 06), Duration = "0", Progress = 30, ParentID = 5 }
7274 };
7375 return Tasks;
7476 }
7577}
76- ```
7778
78- ![ Blazor Gantt Chart with Column Template] ( images/blazor-gantt-chart-column-template.png )
79+ {% endhighlight %}
80+ {% endtabs %}
81+
82+ {% previewsample "https://blazorplayground.syncfusion.com/embed/hjLINOiOiPhfvAzX?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5 " %}
0 commit comments