This is a migrated thread and some comments may be shown as answers.
why is create called for existing events again
3 Answers 50 Views
This is a migrated thread and some comments may be shown as answers.
Entilzha
Top achievements
Rank 2
Entilzha asked on 13 Feb 2014, 03:30 AM
Here is a weird one that I can't seem to figure out.  I have a scheduler that already shows other events.  My problem is that whenever I create a new event or delete an existing event the "create" method gets called for the existing events again.  So every time I do a single "create" all my existing events get duplicated.  The closest thing I could find in this forum is to make sure I have the "batch" turned off but that doesn't make any difference.  Is there some setting I am missing?  My code is below...

@(Html.Kendo().Scheduler<Kendo.Mvc.Examples.Models.Scheduler.TaskViewModel>()
    .Name("scheduler")
    .Date(DateTime.Now)
    .StartTime((DateTime)ViewBag.StartTime)
    .Timezone((string)ViewBag.TimeZone)
    .AllDaySlot(false)
    .Editable(e =>
    {
        e.Create(true);
        e.Destroy(true);
        e.Update(true);
    })
    .Height(590)
    .Views(views =>
    {
        views.DayView();
        views.WeekView(v => v.Selected(true));
        views.MonthView();
        views.AgendaView();
    })
    .DataSource(d => d
        .Model(m =>
        {
            m.Id(f => f.TaskID);
            m.Field(f => f.TaskID);
            m.Field(f => f.Title);
            m.Field(f => f.ProviderId);
            m.Field(f => f.Start);
            m.Field(f => f.StartTimezone);
            m.Field(f => f.EndTimezone);
            m.Field(f => f.Description);
            m.Field(f => f.RecurrenceID);
            m.Field(f => f.RecurrenceRule);
            m.Field(f => f.RecurrenceException);
            m.Field(f => f.OwnerID);
            m.Field(f => f.IsAllDay);
        })
        .Read(read => read.Action("Read", "Scheduler").Data("additionalData"))
        .Create(create => create.Action("Create", "Scheduler").Data("additionalData"))
        .Update(update => update.Action("Update", "Scheduler"))
        .Destroy(destroy => destroy.Action("Destroy", "Scheduler"))
        .ServerOperation(true)
    )
)

public virtual JsonResult Create([DataSourceRequest] DataSourceRequest request, TaskViewModel task, int? providerId)
{
        ...
 
        return Json(new[] { task }.ToDataSourceResult(request, ModelState), JsonRequestBehavior.AllowGet);
}

3 Answers, 1 is accepted

Sort by
0
Entilzha
Top achievements
Rank 2
answered on 14 Feb 2014, 03:30 AM
Any help is appreciated.
0
Accepted
Alexander Popov
Telerik team
answered on 14 Feb 2014, 04:07 PM
Hi Marcus,

Thank you for the provided code. I reviewed it and did not found anything that might be related to the issue. Sending all events to the Create method could happen if the ID (in this case TaskID) of all events is empty or equal to zero, thus recognized as new. I would recommend checking the IDs and also the browser's console log for any errors. In case that is not the issue, then I would ask you to provide a runnable sample project where the it is observed. This would help us pinpoint the exact reason for this behavior and advise you further.

Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Entilzha
Top achievements
Rank 2
answered on 15 Feb 2014, 07:36 PM
Could it really be that easy!?  Let me try it...

Wow!   That was it!  Thank you so much!
Asked by
Entilzha
Top achievements
Rank 2
Answers by
Entilzha
Top achievements
Rank 2
Alexander Popov
Telerik team
Share this question
or