Skip to content

872500: taskbar and notes icon hide code added #4258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: hotfix/hotfix-v29.2.4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ej2-asp-core-mvc/code-snippet/gantt/taskbar-hide/data.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public IActionResult Index()
{
ViewBag.DataSource = GanttData.ProjectNewData();
return View();
}
20 changes: 20 additions & 0 deletions ej2-asp-core-mvc/code-snippet/gantt/taskbar-hide/razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@model List<GanttSample.Controllers.GanttDataSource>

@Html.EJS().Gantt("Editing").DataSource((IEnumerable<object>)ViewBag.DataSource).QueryTaskbarInfo("queryTaskbarInfo").QueryCellInfo("queryCellInfo").TaskFields(ts => ts.Id("TaskId").Name("TaskName").StartDate(
"StartDate").EndDate("EndDate").Duration("Duration").Progress("Progress").Dependency("Predecessor").ParentID("ParentId")).EditSettings(es =>
es.AllowTaskbarEditing(true)).Render()

<script>
function queryTaskbarInfo(args) {
if(args.data.TaskId >= 7 && args.data.TaskId <= 10)
{
args.taskbarElement.style.visibility = "hidden";
}
}
function queryCellInfo(args) {
if(args.column.field == "Info" && (args.data.Info === null || args.data.Info.trim() === ''))
{
args.cell.children[0].style.visibility = "hidden";
}
}
</script>
19 changes: 19 additions & 0 deletions ej2-asp-core-mvc/code-snippet/gantt/taskbar-hide/tagHelper
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<ejs-gantt id='Gantt' dataSource="ViewBag.dataSource" queryTaskbarInfo="queryTaskbarInfo" queryCellInfo="queryCellInfo">
<e-gantt-taskfields id="TaskId" name="TaskName" startDate="StartDate" endDate="EndDate" duration="Duration" progress="Progress" dependency="Predecessor" parentID="ParentId">
</e-gantt-taskfields>
</ejs-gantt>

<script>
function queryTaskbarInfo(args) {
if(args.data.TaskId >= 7 && args.data.TaskId <= 10)
{
args.taskbarElement.style.visibility = "hidden";
}
}
function queryCellInfo(args) {
if(args.column.field == "Info" && (args.data.Info === null || args.data.Info.trim() === ''))
{
args.cell.children[0].style.visibility = "hidden";
}
}
</script>
Binary file added ej2-asp-core-mvc/gantt/images/taskbar-hide.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions ej2-asp-core-mvc/gantt/taskbar.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

### Taskbar and Notes Icon Visibility

By default, taskbars and notes icons are displayed for all tasks in the Gantt chart. However, there may be scenarios where certain taskbars or notes icons need to be hidden dynamically based on specific conditions.

This customization can be accomplished using the [`queryTaskbarInfo`](https://help.syncfusion.com/cr/aspnetcore-js2/syncfusion.ej2.gantt.gantt.html#Syncfusion_EJ2_Gantt_Gantt_QueryTaskbarInfo) and [`queryCellInfo`](https://help.syncfusion.com/cr/aspnetcore-js2/syncfusion.ej2.gantt.gantt.html#Syncfusion_EJ2_Gantt_Gantt_QueryCellInfo) events. These events allow fine-grained control over the rendering of taskbars, notes icons, and their corresponding rows, enabling conditional visibility as needed.

{% if page.publishingplatform == "aspnet-core" %}

{% tabs %}
{% highlight cshtml tabtitle="CSHTML" %}
{% include code-snippet/gantt/taskbar-hide/tagHelper %}
{% endhighlight %}
{% highlight c# tabtitle="data.cs" %}
{% include code-snippet/gantt/taskbar-hide/data.cs %}
{% endhighlight %}
{% endtabs %}

{% elsif page.publishingplatform == "aspnet-mvc" %}

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/gantt/taskbar-hide/razor %}
{% endhighlight %}
{% highlight c# tabtitle="data.cs" %}
{% include code-snippet/gantt/taskbar-hide/data.cs %}
{% endhighlight %}
{% endtabs %}
{% endif %}

![Change Gripper Icon in Taskbar](images/taskbar-hide.png)

## 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.
Expand Down