Open add/edit dialog dynamically

17 Feb 20221 minute to read

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

@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>
public IActionResult Index()
{
    ViewBag.DataSource = GanttData.ProjectNewData();
    return View();
}