From 965ee3648cb2de86d8a9622f81bf84a8b4d15cea Mon Sep 17 00:00:00 2001 From: AjithkumarGopalakrishnan Date: Fri, 13 Jun 2025 11:51:28 +0530 Subject: [PATCH] 838237: show hide taskbar code added --- .../gantt/taskbar-show-hide/data.cs | 5 +++ .../gantt/taskbar-show-hide/razor | 41 ++++++++++++++++++ .../gantt/taskbar-show-hide/tagHelper | 42 +++++++++++++++++++ ej2-asp-core-mvc/gantt/taskbar.md | 31 ++++++++++++++ 4 files changed, 119 insertions(+) create mode 100644 ej2-asp-core-mvc/code-snippet/gantt/taskbar-show-hide/data.cs create mode 100644 ej2-asp-core-mvc/code-snippet/gantt/taskbar-show-hide/razor create mode 100644 ej2-asp-core-mvc/code-snippet/gantt/taskbar-show-hide/tagHelper diff --git a/ej2-asp-core-mvc/code-snippet/gantt/taskbar-show-hide/data.cs b/ej2-asp-core-mvc/code-snippet/gantt/taskbar-show-hide/data.cs new file mode 100644 index 0000000000..eec9005cde --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/gantt/taskbar-show-hide/data.cs @@ -0,0 +1,5 @@ +public IActionResult Index() +{ + ViewBag.DataSource = GanttData.ProjectNewData(); + return View(); +} \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/gantt/taskbar-show-hide/razor b/ej2-asp-core-mvc/code-snippet/gantt/taskbar-show-hide/razor new file mode 100644 index 0000000000..94ae2f3b85 --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/gantt/taskbar-show-hide/razor @@ -0,0 +1,41 @@ +@model List + +
+ + @Html.EJS().Switch("switch").Checked(false).Change("change").Render() +
+@(Html.EJS().Gantt("GanttContainer").DataSource((IEnumerable)ViewBag.DataSource).TaskFields(ts => ts.Id( + "TaskId").Name("TaskName").StartDate("TaskStart").Duration("Duration").Progress("Progress").ParentID("ParentId")).QueryTaskbarInfo("queryTaskbarInfo").Render()) + + + \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/gantt/taskbar-show-hide/tagHelper b/ej2-asp-core-mvc/code-snippet/gantt/taskbar-show-hide/tagHelper new file mode 100644 index 0000000000..6978293e98 --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/gantt/taskbar-show-hide/tagHelper @@ -0,0 +1,42 @@ +
+ + +
+ + + + + + + + \ No newline at end of file diff --git a/ej2-asp-core-mvc/gantt/taskbar.md b/ej2-asp-core-mvc/gantt/taskbar.md index 4e31f0609b..8c9ce2dda2 100644 --- a/ej2-asp-core-mvc/gantt/taskbar.md +++ b/ej2-asp-core-mvc/gantt/taskbar.md @@ -137,6 +137,37 @@ You can change the gripper icon in the taskbar by applying styles to their respe ![Change Gripper Icon in Taskbar](images/change-gripper-icon.png) +### Dynamically Showing or Hiding Taskbars + +In a Gantt chart, taskbars are typically displayed by default to represent task information. However, in some scenarios, it may be necessary to dynamically show or hide specific taskbars based on custom conditions. + +During the initial render, taskbar visibility can be controlled using the [`queryTaskbarInfo`](https://help.syncfusion.com/cr/aspnetcore-js2/syncfusion.ej2.gantt.gantt.html#Syncfusion_EJ2_Gantt_Gantt_PdfQueryTaskbarInfo) event. Within this event, you can apply custom CSS classes to hide certain taskbars—for example, hiding only parent taskbars based on specific logic. + +After the Gantt chart has been rendered, taskbar visibility can also be updated dynamically. For example, you can use a toggle button to show or hide taskbars by updating the Gantt chart instance and modifying the relevant taskbar elements. + +{% if page.publishingplatform == "aspnet-core" %} + +{% tabs %} +{% highlight cshtml tabtitle="CSHTML" %} +{% include code-snippet/gantt/taskbar-show-hide/tagHelper %} +{% endhighlight %} +{% highlight c# tabtitle="data.cs" %} +{% include code-snippet/gantt/taskbar-show-hide/data.cs %} +{% endhighlight %} +{% endtabs %} + +{% elsif page.publishingplatform == "aspnet-mvc" %} + +{% tabs %} +{% highlight razor tabtitle="CSHTML" %} +{% include code-snippet/gantt/taskbar-show-hide/razor %} +{% endhighlight %} +{% highlight c# tabtitle="data.cs" %} +{% include code-snippet/gantt/taskbar-show-hide/data.cs %} +{% endhighlight %} +{% endtabs %} +{% endif %} + ## Multi Taskbar support in project view The Gantt component, supports rendering multi-taskbars in the project view. With this feature the parent taskbar, when it is collapsed, visually summarize the progress of all its child taskbars.