We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Collection "editedRecords"

Hello Support,

Version 17.2.0.51

i like to use gannt-chart to update our project database.
I defined a Sync button -> this function should save all updates from the Gannt-Chart to our Database.
I found in the DataStructure the collection "editedRecords" but it was empty after editing the GanttChart.
Do you plan to populate this collection in a next version ?

i also tried the event "EndEdit" but it was not fired wenn i press the save button in the Edit-Dialog.

Do you have an example with best praxis to save the updated Date back to the webserver?

Thank you for your support
with best regards from Austria
Peter

1 Reply

GA Gurunathan A Syncfusion Team September 18, 2019 11:17 AM UTC

Hi Peter, 
 
In Gantt, we have provided support to update the CRUD action updates in Gantt control to server by using DataManager support. By using this support in Gantt, we can pass the updated data source to server on CRUD actions. We can define data source for Gantt as instance of DataManager and by using BatchUrl property of DataManager we can update the data source on CRUD operation. Please find the below code example. 
 
[HomeController.cs] 
        public ActionResult BatchSave([FromBody]ICRUDModel<TreeGridProjectData> data) 
        { 
             //... 
            if (data.added != null && data.added.Count() > 0) 
            { 
                foreach (var rec in data.added) 
                { 
                    uAdded.Add(this.Create(rec)); 
                } 
            } 
 
            ////Performing update operation 
            if (data.changed != null && data.changed.Count() > 0) 
            { 
                foreach (var rec in data.changed) 
                { 
                    uChanged.Add(this.Edit(rec)); 
                } 
            } 
 
            //Performing delete operation 
            if (data.deleted != null && data.deleted.Count() > 0) 
            { 
                foreach (var rec in data.deleted) 
                { 
                    uDeleted.Add(this.Delete(rec.taskID)); 
                } 
            } 
            return Json(new { addedRecords = uAdded, changedRecords = uChanged, deletedRecords = uDeleted}); 
        } 
        public TreeGridProjectData Create(TreeGridProjectData value) 
        { 
            //... 
        } 
 
        public TreeGridProjectData Edit(TreeGridProjectData value) 
        { 
            //... 
        } 
 
 
        public TreeGridProjectData Delete(string value) 
        { 
           //... 
        } 
 
[index.cshtml] 
@(Html.EJS().Gantt("DefaultFunctionalities") 
        .DataSource(dataManager => { dataManager.Url("/Home/UrlDatasource") 
        .BatchUrl("/Home/BatchSave") 
        .Adaptor("UrlAdaptor"); }) 
        //... 
       .Render() 
) 
 
Please find the below sample link. 
 
Note: In all server-side update, we have passed the data as array of object, because in Gantt when edit any task all parent and dependent task are updated and on delete action, if the task has children all children task also deleted. So, by default we have passed the updated task details as array to server. 
 
Regards, 
Gurunathan 


Loader.
Live Chat Icon For mobile
Up arrow icon