Search results

Restrict collapsing of records when clicking on Gantt chart rows in ASP.NET MVC Gantt control

15 Oct 2021 / 1 minute to read

Restriction of collapsing the records when clicking on gantt chart rows can be performed by using the collapsing event.

razor
restrictcollapsechartrows.cs
Copied to clipboard
@Html.EJS().Gantt("Gantt").DataSource((IEnumerable<object>)ViewBag.DataSource).Height("450px").TaskFields(ts => ts.Id("TaskId").Name(
        "TaskName").StartDate("StartDate").EndDate("EndDate").Duration("Duration").Progress("Progress").Child("SubTasks")).EditSettings(es =>
         es.AllowEditing(true).AllowAdding(true)).Collapsing("Collapsing").Render()
        
	<script>
       function Collapsing(args) {
           var gantt = document.getElementById("Gantt").ej2_instances[0];
           if (gantt.ganttChartModule.isExpandCollapseFromChart) {
               args.cancel = true;
        }
    }
	</script>
Copied to clipboard
public IActionResult Index()
{
    ViewBag.DataSource = GanttData.ProjectNewData();
    return View();
}