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?