Batch Editing in ASP.NET CORE Tree Grid Component
21 Dec 20222 minutes to read
In Batch edit mode, when you double-click on the treegrid cell, the target cell goes into edit state. You can bulk save (added, changed and deleted data in the single request) to data source by clicking on the toolbar’s Update button or by externally invoking the batchSave
method. To enable Batch edit, set the EditSettings.mode
as Batch.
<ejs-treegrid id="TreeGrid" dataSource="ViewBag.dataSource" height="400" idMapping="TaskId" parentIdMapping="ParentId" treeColumnIndex="1" toolbar="@(new List<string>() { "Add", "Delete", "Update", "Cancel" })">
<e-treegrid-editsettings allowAdding="true" allowEditing="true" allowDeleting="true" mode="Batch" newRowPosition="Below"></e-treegrid-editsettings>
<e-treegrid-columns>
<e-treegrid-column field="TaskId" headerText="Task ID" isPrimaryKey="true" validationRules="@(new { required=true, number=true})" textAlign="Right" width="90"></e-treegrid-column>
<e-treegrid-column field="TaskName" headerText="Task Name" validationRules="@(new { required=true})" editType="stringedit" width="220"></e-treegrid-column>
<e-treegrid-column field="StartDate" headerText=" Start Date" validationRules="@(new { date=true})" editType="datepickeredit" textAlign="Right" format="yMd" type="date" width="130"></e-treegrid-column>
<e-treegrid-column field="Duration" headerText="Duration" validationRules="@(new { number = true, min = 0 })" editType="numericedit" textAlign="Right" edit="@(new { @params = new { format = "n" } })" width="100"></e-treegrid-column>
<e-treegrid-column field="Progress" headerText="Progress" textAlign="Right" width="80" editType="numericedit" validationRules="@(new { number = true, min = 0 })" edit="@(new { @params = new { format = "n" } })"></e-treegrid-column>
<e-treegrid-column field="Priority" headerText="Priority" width="90" editType="stringedit" validationRules="@(new { required=true})"></e-treegrid-column>
</e-treegrid-columns>
</ejs-treegrid>
public IActionResult Index()
{
var tree = TreeData.GetDefaultData();
ViewBag.dataSource = tree;
return View();
}
NOTE
You can refer to our
ASP.NET Core Tree Grid
feature tour page for its groundbreaking feature representations. You can also explore our ASP.NET Core Tree Grid exampleASP.NET Core Tree Grid example
to knows how to present and manipulate data.