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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Collection "editedRecords"

Thread ID:

Created:

Updated:

Platform:

Replies:

147581 Sep 17,2019 08:39 AM UTC Sep 18,2019 11:17 AM UTC ASP.NET MVC - EJ 2 1
loading
Tags: Gantt Chart
Peter Rosenstein
Asked On September 17, 2019 08:39 AM UTC

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

Gurunathan A [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon