Open add/edit dialog dynamically

17 Feb 20222 minutes to read

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

<ejs-gantt id='Gantt' dataSource="ViewBag.dataSource" height="450px">
                    <e-gantt-taskfields id="TaskId" name="TaskName" startDate="StartDate" endDate="EndDate" duration="Duration" collapsing="collapsing" progress="Progress" child="SubTasks">
                    </e-gantt-taskfields>
                    <e-gantt-editsettings allowAdding="true" allowEditing="true"></e-gantt-editsettings>
                </ejs-gantt>
				
				<script>
				   function contextMenuOpen(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();
}