edit dialog Open and Editing and Click Save But Data not Save to MSSQL

I use SCH works well.

I edited through the controls cell edit mode in Figure 1 and Figure 2. Can work normally

ActionComplete Call to url: '@Url.Action("UpdateScheduling", "Scheduling")', Figure 3.

But I Edit Normal Editing 
edit dialog Open and Editing and Click Save Figure 4.
ActionComplete not Fire Data not Update to MSSQL
Help me fix it.


Code Example Below


 @(Html.EJ().Gantt("Gantt")
.TaskIdMapping("Id")
.TaskNameMapping("Name")
.StartDateMapping("StartDate")
.EndDateMapping("EndDate")
.DurationMapping("Duration")
.ProgressMapping("PercentDone")
.NotesMapping("Note")
.TreeColumnIndex(1)
.ChildMapping("Children")
.EditSettings(edit =>
{
    //edit.AllowAdding(true);
    edit.AllowEditing(true);
    //edit.EditMode("taskbarediting");
    edit.EditMode("cellediting");
    //edit.EditMode("normal"); //Update the task details through edit dialog
    //edit.AllowDeleting(true);
    //edit.ShowDeleteConfirmDialog(true);
    edit.AllowIndent(true);
})
.ToolbarSettings(toolbar =>
{
    toolbar.ShowToolbar(true);
    toolbar.ToolbarItems(new List<GanttToolBarItems>()
{
                          //GanttToolBarItems.Add,
                          GanttToolBarItems.Edit,
                          //GanttToolBarItems.Delete,
                          GanttToolBarItems.Save,
                          GanttToolBarItems.Update,
                          GanttToolBarItems.Indent,
                          GanttToolBarItems.Outdent,
                          GanttToolBarItems.ExpandAll,
                          GanttToolBarItems.CollapseAll,
                          GanttToolBarItems.CriticalPath
});
})
.SizeSettings(eve =>
{
    eve.Height("550px");
})
.ClientSideEvents(eve =>
{
    //eve.QueryTaskbarInfo("queryTaskbarInfo");
    eve.ActionComplete("ActionComplete");
})
//.IncludeWeekend(true)
.WeekendBackground("rgba(116, 195, 231, 0.26)")
//.AllowSorting(false)
.EnableAltRow(true)
.AllowColumnResize(true)
//.ShowColumnChooser(true)
.AllowSelection(true)
.SelectionMode(GanttSelectionMode.Row)
.ShowProgressStatus(true)
.EnableVirtualization(false)
.AllowGanttChartEditing(true) //Update the task details by interactions such as resizing and dragging the taskbar
.EnableProgressBarResizing(true) //You can also enable or disable the progress bar resizing by using the EnableProgressBarResizing.
                                 //.TaskSchedulingMode(GanttTaskSchedulingMode.Auto)
.EnableContextMenu(true)
.ReadOnly(ViewBag.ReadOnly)
.Datasource(ViewBag.DataSource)
                    )
                    @(Html.EJ().ScriptManager())
                </div>

-----------------
function ActionComplete(args) {
        if (args.requestType === 'save' && args.addedRecord) {
            addedItem = args.addedRecord.item;
            var addedRecord = JSON.stringify({
                'Task': addedItem
                //,'Resource': args.addedRecord.resourceInfo
            });
            $.ajax({
                type: "POST",
               // url: "/Scheduling/AddScheduling",//Add is Server side method
               // url: '@Url.Action("AddScheduling", "Scheduling")',
                url: '@Url.Action("UpdateScheduling", "Scheduling")',
                data: addedRecord,
                traditional: true,
                contentType: 'application/json'
            });
        }
        else if (args.requestType === 'outdent' || args.requestType === 'recordUpdate') {
            var editedRecord = args.data.item;
            var data = JSON.stringify({
                'Task': editedRecord
                //,'Resource': args.data.resourceInfo
            });
            $.ajax({
                type: "POST",
                //url: "/Scheduling/UpdateScheduling",  //Update is Server side method
                url: '@Url.Action("UpdateScheduling", "Scheduling")',
                data: data,
                traditional: true,
                contentType: 'application/json'
            });
        }
    }


Attachment: Capture_SCH_f2459fe0.zip

3 Replies

JR John Rajaram Syncfusion Team September 5, 2018 08:52 AM UTC

Hi Miclejee, 
Thank you for contacting Syncfusion support. 
In Gantt after performing the cell editing, actionComplete client side event will be triggered with requestType argument value as “recordUpdate”. But if we perform the dialogEditing then actionComplete event will be triggered with requestType argument value as “save” along with “modifiedRecord” value as argument. So we suggest you to use the following code snippets for updating the database during dialog Editing. 
@(Html.EJ().Gantt("Gantt") 
       .TaskIdMapping("TaskId") 
        .EditSettings(edit => 
       { 
           edit.AllowEditing(true); 
           edit.EditMode("normal"); //Update the task details through edit dialog 
           edit.AllowIndent(true); 
       }) 
        .ClientSideEvents(eve => 
    { 
        eve.ActionComplete("actionComplete"); 
    }) 
     //.. 
) 
 @(Html.EJ().ScriptManager()) 
 
<script type="text/javascript"> 
        function actionComplete(args) { 
                         if (args.requestType == "indent" || args.requestType == "outdent" || args.requestType == "recordUpdate" || (args.requestType === 'save' && args.modifiedRecord)) { 
                var ganttRec = []; 
                if (args.requestType == "save") 
                    ganttRec.push(args.modifiedRecord); 
                else 
                    ganttRec.push(args.data); 
                if (args.updatedRecords && args.updatedRecords.length) 
                    ganttRec = ganttRec.concat(args.updatedRecords); 
                updateRecords(ganttRec); 
            } 
</script> 
 
We have also prepared the sample for your reference, please find the sample from below link 
We have attached our Knowledge Base article for performing the crud operation in Gantt. 
Please let us know if you require further assistance on this. 
Regards, 
John R 



MJ MJ September 10, 2018 06:53 AM UTC

Yesss !!!
Very Good.
THX.


JR John Rajaram Syncfusion Team September 10, 2018 12:50 PM UTC

Hi Miclejee,  
Thank you for the update. Please let us know if you need further assistance on this. 
Regards, 
John R 


Loader.
Up arrow icon