Actioncomplete script not triggered in gantt chart

Hello, I am trying to update database with ajax. I'm using sql server with Entity framework. It seems that actioncomplete method doesn't work.  have added actioncomplete="actionComplete" in my Gantt listing, added the actioncomplete script, but the script will never be triggered. Please, help.

This is my Gantt listing:



@using Syncfusion.EJ2.Gantt;


Essential Studio for JavaScript : Project Tracker




actionComplete="actionComplete" renderBaseline="true" toolbar="@(new List() { "Add", "Edit", "Update", "Delete", "Cancel","ZoomIn","ZoomOut","ZoomToFit"})">


progress="Progress" dependency="Predecessor">



allowTaskbarEditing="true" showDeleteConfirmDialog="true" mode="Auto">










This is my controller:

using Microsoft.AspNetCore.Mvc;

using Proposta.Models;

using Syncfusion.EJ2.Base;

using System;

using System.Collections.Generic;

using System.Linq;

using System.Threading.Tasks;



namespace Proposta.Controllers

{

public class ODLGanttController : Controller

{


private readonly DataContext _context;


public ODLGanttController(DataContext context)

{

_context = context;

}




public IActionResult Index(int Id)

{

var context = new DataContext();

List lista = new List();

lista = _context.Ordine_Di_Lavoro.Where(o => o.IdOrdine == Id).ToList();

ViewBag.dataSource = lista;


return View();


}



[HttpPost()]

public ActionResult Add(Ordine_Di_Lavoro Task)

{

using (_context)

{

var insertData = new Ordine_Di_Lavoro()

{

TaskId = Task.TaskId,

TaskName = Task.TaskName,

StartDate = Task.StartDate,

EndDate = Task.EndDate,

Progress = Task.Progress

};

_context.Ordine_Di_Lavoro.Add(insertData);

_context.SaveChanges();

}

return Json(Task);

}

[HttpPost()]

public ActionResult Update(Ordine_Di_Lavoro Tasks)

{

using (_context)

{

var updateData = _context.Ordine_Di_Lavoro.FirstOrDefault(x => x.TaskId == Tasks.TaskId);

updateData.TaskId = Tasks.TaskId;

updateData.TaskName = Tasks.TaskName;

updateData.StartDate = Tasks.StartDate;

updateData.EndDate = Tasks.EndDate;

updateData.Progress = Tasks.Progress;

_context.SaveChanges();

}

return Json(Tasks);

}

[HttpPost()]

public ActionResult Delete(Ordine_Di_Lavoro Task)

{

using (_context)

{

var deleteData = _context.Ordine_Di_Lavoro.Single(r => r.TaskId == Task.TaskId);

_context.Ordine_Di_Lavoro.Remove(deleteData);

_context.SaveChanges();

}

return Json(Task);

}





}

}












11 Replies

LA Lokesh Arjunan Syncfusion Team October 6, 2021 12:52 PM UTC

Hi David 
 
We have validated your query and found you can update database using DataManager. We have DataManager support in Gantt, which calls the BatchSave method and updates the database when you execute CRUD operations. For further reference you can look into below documentation link. 
 
 
 
Regards, 
Lokesh 



DA David October 6, 2021 02:54 PM UTC

Thank you very much, Lokesh!

I am following another way, as you can see here:

https://www.syncfusion.com/kb/10177/how-to-perform-crud-actions-in-gantt-chart-using-entity-framework

It is a very clean way to manage crud operations in Gantt ej, but I am not able to repeat this in ej2. Is it possible to have a working sample of this solution with ejs and Entity framework? I don't want to use DataManager

P.S.: your support is great! 



LA Lokesh Arjunan Syncfusion Team October 7, 2021 01:58 PM UTC

Hi David 
 
We have validated your query and where actionComplete event gets triggered for CRUD operations. We have attached sample for your reference. If you are still facing the issue, Please share us the video demonstration or if possible please replicate in the attached sample. 
 
 
 
Regards, 
Lokesh 
 



DA David October 7, 2021 03:51 PM UTC

Hi, Lokesh, thank you very much!



RP Ranjani Prabakaran Syncfusion Team October 11, 2021 04:31 AM UTC

Hi Davide, 

Thanks for letting us know that the issue has been resolved. Please contact us if you need any further assistance. 

Regards, 

Ranjani 



DA David replied to Ranjani Prabakaran November 23, 2021 10:34 PM UTC

     Good morning, Sirs, 

     I've finally followed your suggestions, and achieved my goal: now I'm able to fetch data from sqlserver, editing and save to database. All of these using Datamanager support. Thank you very much!

     Now I have two small issue: 

1) I cannot see dependency lines in my taskbar, as you can see in the attached image;

2) I cannot edit anything from taskbar, I can edit only from the grid. In practical... taskbar is readonly.

     Could I riceive your precious support another time?

Thank you so much in advance! 


Attachment: Gantt_84128bf9.rar


DA David November 23, 2021 10:38 PM UTC

Here attached  you can find the Gantt chart without lines...


Attachment: Gantt1_5eb67b.rar


MS Monisha Sivanthilingam Syncfusion Team November 24, 2021 11:12 AM UTC

Hi David, 
 
We have prepared a sample using the DataManager to display the data in the Gantt. In this sample, the predecessors are rendered properly and we are also able to perform taskbar editing actions also. Please find the sample from the below link. 
 
 
Please modify the sample to replicate your issue or share an issue reproducible sample of your own. 
 
Regards, 
Monisha. 



DA David November 24, 2021 11:43 AM UTC

Hi, Monisha, thank you for your kind reply!

I've tryed your solution, connecting to my URLDatasource, but the result is the same (as you can see from attached image).

Every kind of idea will be precious. I've lerned the whole Syncfusion Gantt Chart Documentation, and I've followed all the directions perfectly.

Thank you!


Attachment: Gantt2_cc840d2d.rar


DA David November 24, 2021 04:14 PM UTC

Hi, Monisha, 

I've found that there was a Blazor tag in _Layout.cshtml that was disturbing my Gantt chart.

It was this: 

<base rel='nofollow' href="~/" />

Once I get rid of this, I can see my dependency lines again, as you can see in the image here attached.

But....

Now I've lost CRUD functionallity, as the BatchSave methos never get triggered anymore.

So, if I get the lines I don't get the CRUD; If I get the CRUD I don't get the lines. Is it a bug?

I have Asp.net Core with MVC and .net 5.0

Could you suggest me something?

Thank you so much!

David



Attachment: Gantt3_a8e0c13b.rar


MS Monisha Sivanthilingam Syncfusion Team November 26, 2021 11:15 AM UTC

Hi David, 
 
We have analyzed your query, however, we were unable to replicate the issue you reported. Please share an issue reproducible sample of your own, so that we may analyze your sample to identify the issue. You can also use the below sample for reference. 
 
 
Regards, 
Monisha. 


Loader.
Up arrow icon