I'm using the new GANTT form, and while i have read/create/update working fine, the delete doesn't work at all. I'm using MVC, and it's not even reaching my controller, i get a 'Uncaught TypeError: undefined is not a function'. Clicking on the source of that error in google chrome, i just get the following script:
(function(d, __f, __o
/**/) {
return ((d.successorId || '').toLowerCase() == '60ae635d-4d7e-490b-9433-0a691adc0a03')
})
I am using GUIDs as my Model ID instead of integers. If it helps, here is my GANTT cshtml:
@(Html.Kendo().Gantt<CoBRAMVC4Portal.Areas.Admin.Models.OpPeriodTaskViewModel, CoBRAMVC4Portal.Areas.Admin.Models.OpPeriodDependencyViewModel>()
.Name("Gantt")
.Columns(columns =>
{
columns.Bound("title").Editable(true).Sortable(true);
columns.Bound("start").Title("Start Time").Format("{0:G}").Editable(true).Sortable(true);
columns.Bound("end").Title("End Time").Format("{0:G}").Editable(true).Sortable(true);
})
.Views(views =>
{
views.DayView();
views.WeekView(weekView => weekView.Selected(true));
views.MonthView();
})
.ShowWorkHours(false)
.ShowWorkDays(false)
.Snap(false).Selectable(true).Navigatable(false)
.DataSource(ds => ds
.Read(read => read
.Action("_GetOpPeriods", "ProjectAdmin", new { area = "Admin", id = ViewContext.RouteData.Values["id"].ToString() })
)
.Model(m =>
{
m.Id(f => f.TaskID);
m.ParentId(f => f.ParentID);
m.OrderId(f => f.OrderId);
m.Field(f => f.Expanded).DefaultValue(true);
})
.Destroy(destroy => destroy.Action("_DeleteOpPeriod", "ProjectAdmin", new { area = "Admin", id = ViewContext.RouteData.Values["id"].ToString() }).Type(HttpVerbs.Post))
.Update(update => update.Action("_UpdateOpPeriod", "ProjectAdmin", new { area = "Admin", id = ViewContext.RouteData.Values["id"].ToString() }).Type(HttpVerbs.Post))
.Create(create => create.Action("_AddOpPeriod", "ProjectAdmin", new { area = "Admin", id = ViewContext.RouteData.Values["id"].ToString() }).Type(HttpVerbs.Post))
)
.DependenciesDataSource(ds => ds
.Read(read => read
.Action("_GetDependencies", "ProjectAdmin", new { area = "Admin", id = ViewContext.RouteData.Values["id"].ToString() })
)
.Model(m =>
{
m.Id(f => f.DependencyID);
m.PredecessorId(f => f.PredecessorID);
m.SuccessorId(f => f.SuccessorID);
m.Type(f => f.Type);
})
)
)
and here is my controller code:
[AcceptVerbs(HttpVerbs.Post)]
[CoBRAMVC4Portal.CustomProviders.CustomAuthorize(Roles = "OrgAdmin,SysAdmin,NormalUser")]
public ActionResult _DeleteOpPeriod([DataSourceRequest] DataSourceRequest request, OpPeriodTaskViewModel item, Guid id)
{
if ((item != null) && (item.TaskID != Guid.Empty))
{
WebEngine.RemoveOperationalPeriod(CoBRAMVC4Portal.App_Start.StructuremapMvc.StructureMapDependencyScope.Container.GetInstance<DGI.CoBRAPlugInSDK.IDatabaseMethods>("Log"), item.TaskID);
}
return Json(ModelState.ToDataSourceResult(request,ModelState ), JsonRequestBehavior.DenyGet);
}
any help would be appreciated!
(function(d, __f, __o
/**/) {
return ((d.successorId || '').toLowerCase() == '60ae635d-4d7e-490b-9433-0a691adc0a03')
})
I am using GUIDs as my Model ID instead of integers. If it helps, here is my GANTT cshtml:
@(Html.Kendo().Gantt<CoBRAMVC4Portal.Areas.Admin.Models.OpPeriodTaskViewModel, CoBRAMVC4Portal.Areas.Admin.Models.OpPeriodDependencyViewModel>()
.Name("Gantt")
.Columns(columns =>
{
columns.Bound("title").Editable(true).Sortable(true);
columns.Bound("start").Title("Start Time").Format("{0:G}").Editable(true).Sortable(true);
columns.Bound("end").Title("End Time").Format("{0:G}").Editable(true).Sortable(true);
})
.Views(views =>
{
views.DayView();
views.WeekView(weekView => weekView.Selected(true));
views.MonthView();
})
.ShowWorkHours(false)
.ShowWorkDays(false)
.Snap(false).Selectable(true).Navigatable(false)
.DataSource(ds => ds
.Read(read => read
.Action("_GetOpPeriods", "ProjectAdmin", new { area = "Admin", id = ViewContext.RouteData.Values["id"].ToString() })
)
.Model(m =>
{
m.Id(f => f.TaskID);
m.ParentId(f => f.ParentID);
m.OrderId(f => f.OrderId);
m.Field(f => f.Expanded).DefaultValue(true);
})
.Destroy(destroy => destroy.Action("_DeleteOpPeriod", "ProjectAdmin", new { area = "Admin", id = ViewContext.RouteData.Values["id"].ToString() }).Type(HttpVerbs.Post))
.Update(update => update.Action("_UpdateOpPeriod", "ProjectAdmin", new { area = "Admin", id = ViewContext.RouteData.Values["id"].ToString() }).Type(HttpVerbs.Post))
.Create(create => create.Action("_AddOpPeriod", "ProjectAdmin", new { area = "Admin", id = ViewContext.RouteData.Values["id"].ToString() }).Type(HttpVerbs.Post))
)
.DependenciesDataSource(ds => ds
.Read(read => read
.Action("_GetDependencies", "ProjectAdmin", new { area = "Admin", id = ViewContext.RouteData.Values["id"].ToString() })
)
.Model(m =>
{
m.Id(f => f.DependencyID);
m.PredecessorId(f => f.PredecessorID);
m.SuccessorId(f => f.SuccessorID);
m.Type(f => f.Type);
})
)
)
and here is my controller code:
[AcceptVerbs(HttpVerbs.Post)]
[CoBRAMVC4Portal.CustomProviders.CustomAuthorize(Roles = "OrgAdmin,SysAdmin,NormalUser")]
public ActionResult _DeleteOpPeriod([DataSourceRequest] DataSourceRequest request, OpPeriodTaskViewModel item, Guid id)
{
if ((item != null) && (item.TaskID != Guid.Empty))
{
WebEngine.RemoveOperationalPeriod(CoBRAMVC4Portal.App_Start.StructuremapMvc.StructureMapDependencyScope.Container.GetInstance<DGI.CoBRAPlugInSDK.IDatabaseMethods>("Log"), item.TaskID);
}
return Json(ModelState.ToDataSourceResult(request,ModelState ), JsonRequestBehavior.DenyGet);
}
any help would be appreciated!