Contact Support
Indent and Outdent in Gantt
23 Sep 20222 minutes to read
Indent and Outdent of a task are used to update the level of the task in hierarchical order of the task. It can be performed bu enabling the editSettings.allowEditing
property.
Indent
- Selected task can be indented to the level of task to the hierarchical order. It can be performed by using in-built context menu or toolbar items. It can also be invoked by using the indent
method dynamically on any action like external button click. The following code example shows how to enable indent option in the Gantt chart.
Outdent
- Selected task can be outdented to the level of task from the hierarchical order. It can be performed by using in-built context menu or toolbar items. It can also be invoked by using the outdent
method dynamically on any action like external button click. The following code example shows how to enable outdent option in the Gantt chart.
@Html.EJS().Button("indent").Content("Indent").CssClass("e-primary").Render()
@Html.EJS().Button("outdent").Content("Outdent").CssClass("e-primary").Render()
@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)).Toolbar(new List<string>()
{ "Indent", "Outdent" }).Render()
<script>
document.getElementById('indent').addEventListener('click', function (args) {
var ganttObj = document.getElementById('Gantt').ej2_instances[0];
ganttObj.indent();
});
document.getElementById('outdent').addEventListener('click', function (args) {
var ganttObj = document.getElementById('Gantt').ej2_instances[0];
ganttObj.outdent();
});
</script>
public ActionResult Index()
{
ViewBag.DataSource = ProjectNewData();
return View();
}