This is a migrated thread and some comments may be shown as answers.

Destroy action not fired

2 Answers 80 Views
Gantt
This is a migrated thread and some comments may be shown as answers.
Riccardo
Top achievements
Rank 1
Riccardo asked on 03 Feb 2020, 04:11 PM

Hello,

my problem is related to the destroy action, when called a js error is returned (see attached file), but when you call an update on another task the gantt fires the update and then the pending destroy action.

my destroy action:

[AcceptVerbs("Post")]
public ActionResult ResourcePlanningDeleteLogic([DataSourceRequest] DataSourceRequest request, ResourcePlanningViewModel ResourcePlanning)
{
    if (ResourcePlanning != null && ModelState.IsValid)
    {
        _resourcePlanningService.Deletelogic(ResourcePlanning);
    }
 
    return Json(new[] { ResourcePlanning }.ToDataSourceResult(request, ModelState));
 
}

 

my gantt:

@(Html.Kendo().Gantt<ResourcePlanningViewModel, ResourcePlanningDependencyViewModel>
    ()
    .Name("gantt")
    .Columns(columns =>
    {
        columns.Bound(c => c.Title).Title("Pianificazione").Width(150).Editable(false).Sortable(true);
        columns.Bound(c => c.Start).Format("{0: dd/MM/yyyy}").Title("Data Da").Width(50).Editable(false).Sortable(true);
        columns.Bound(c => c.End).Format("{0: dd/MM/yyyy}").Title("Data A").Width(50).Editable(false).Sortable(true);
        columns.Bound(c => c.ConsRuleHours).Title("H Reg Cons").Width(60).Editable(false).Sortable(true);
        columns.Bound(c => c.IsFrozen).Title("Congelata").Width(50).Editable(false).Sortable(false);
    })
    .Views(views =>
    {
        views.DayView();
        views.WeekView(weekView => weekView.Selected(false)).DayHeaderTemplate("#=kendo.toString(start, 'dd/MM')#");
        views.WeekView(weekView => weekView.Selected(false)).WeekHeaderTemplate("#=kendo.toString(start, 'D')# - #=kendo.toString(kendo.date.addDays(end, -1), 'D')#").Selected(true);
        views.MonthView(monthView => monthView.Selected(false).MonthHeaderTemplate("#=kendo.toString(start, 'M')#")).WeekHeaderTemplate("#=kendo.toString(start, 'dd/MM')#");
    })
    .Height(700)
    .ShowWorkHours(false)
    .ShowWorkDays(false)
    .Snap(false)
    .Toolbar(tb => tb.Pdf())
    .DataSource(d => d
        .Model(m =>
        {
            m.Id(f => f.Id);
            m.ParentId(f => f.ParentID);
            m.Field(f => f.Expanded).DefaultValue(false);
        })
        .Read(read => read.Action("ResourcePlanningRead", "ResourcePlanning"))
        .Destroy("ResourcePlanningDeleteLogic", "ResourcePlanning")
        .Update(update => update.Action("ResourcePlanningUpdate", "ResourcePlanning").Data("onUpdateCreate"))
    )
    .DependenciesDataSource(d => d
        .Model(m =>
        {
            m.Id(f => f.DependencyID);
            m.PredecessorId(f => f.PredecessorID);
            m.SuccessorId(f => f.SuccessorID);
        })
        .Read("ReadResourcePlanningDependencies", "Gantt")
    )
    .Pdf(pdf => pdf
        .FileName("Pianificazione Risorse.pdf")
        .ProxyURL(Url.Action("Pdf_Export_Save", "Gantt"))
    )
    .Editable(editable => editable.Create(false)
                                  .Resize(false)
                                  .DragPercentComplete(false)
                                  .Reorder(false)
                                  .DependencyCreate(false)
                                  .DependencyDestroy(false)
                                  .Confirmation(true)
                                  .Destroy(true)
                                  .Move(false)
                                  .TemplateId("TaskEditorTemplate")
    )
    .Messages(m => m.Save("Salva")
                    .Cancel("Annulla")
                    .Destroy("Cancella")
                    .DeleteTaskConfirmation("Sei sicuro di voler cancellare la pianificazione?")
                    .DeleteTaskWindowTitle("Cancella Pianificazione")
                    .Editor(e => e.EditorTitle("Aggiorna Pianificazione")
                                  .AssignButton("Aggiungi Regola di Consuntivazione")
                                  .ResourcesEditorTitle("Regola di Consuntivazione"))
                    .Views(v => v.Day("Giornaliera")
                                 .Week("Settimanale")
                                 .Month("Mensile"))
                    .Actions(a => a.Pdf("Esporta in PDF"))
    )
)

 

Is there maybe a data error that prevents the first call to the destroy action?

 

2 Answers, 1 is accepted

Sort by
0
Riccardo
Top achievements
Rank 1
answered on 05 Feb 2020, 08:19 AM
Can you please reply? This is quite urgent
0
Plamen
Telerik team
answered on 06 Feb 2020, 02:19 PM

Hello,

I have inspected the issue but could not replicate the issue at my side. The code looks quite similar to the one that we use on our demos yet I could not observe the error there. In such case since the cause of the issue may be some where in the application code that is not shared I would recommend you to try to isolated the issue in a sample runnable application and send it to us together with the steps needed to observe it so we could inspect it and be more helpful.

Regards,
Plamen
Progress Telerik

Get quickly onboarded and successful with Telerik UI for ASP.NET Core with the dedicated Virtual Classroom technical training, available to all active customers.
Tags
Gantt
Asked by
Riccardo
Top achievements
Rank 1
Answers by
Riccardo
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or