Kendo Scheduler events disappear after canceling editing

I installed the Kendo Scheduler widget using the Kendo Web GPL version 2013.3.1119.

Basically, it works fine when events are pulled from a remote SchedulerDataSource and correctly displayed on the calendar with the corresponding resource.

The problem is ... when I double-click an event, when a pop-up editor containing the correct data is displayed, but if I click Cancel or close "X", the event will be deleted from the calendar.

There are no errors, the event just disappears.

Any ideas what could be causing this?

+6
source share
3 answers

I think I found the problem. The configuration of a SchedulerDataSource is a little counterintuitive.

My database stores the event identifier as id , but taskId is required for the taskId , so this field is defined as:

 taskId: { from: 'id', type: 'number' } 

but I did not understand that you also needed to define the id model as taskId , and not what was actually returned by the server.

So, the full SchedulerDataSource schema looks like this:

 schema: { data: 'data', total: 'total', model: { id: 'taskId', fields: { taskId: { from: 'id', type: 'number' }, title: { from: 'title', defaultValue: 'No title', validation: { required: true } }, start: { type: 'date', from: 'start' }, end: { type: 'date', from: 'end' }, description: { from: 'description' }, ownerId: { from: 'employee_id' }, isAllDay: { type: 'boolean', from: "allDay" }, type_id: { type: 'number' } } } } 

Just out of interest, does anyone know that you can define field aliases using from: 'server-field' in a regular Kendo data source? May be helpful.

+10
source

I also had to update this object inside the Kendo Scheduler object:

  $("#schedulerID").getKendoScheduler().dataSource._pristineData 

When I add a new task to the scheduler, a new object is added to the end of this _pristineData array, but the id field is empty. If I canceled editing ... These new ones will disappear in the browser. Then I update the Kendo Scheduler object this way:

  var length = $("schedulerID").getKendoScheduler().dataSource._pristineData.length; $("#schedulerID").getKendoScheduler().dataSource._pristineData[length - 1].id = id; 

... and works for me.

0
source

Exceptional problem I had. And the reason for this β€œerror” was that I created the model incorrectly. In my case, all identifiers for all events were the same. Thus, double-check event identifiers for uniqueness.

Razor Syntax Example:

 @Html.Kendo().Scheduler<EventsViewModel>() .Name("scheduleTimes") .Timezone("Etc/UTC") .Views(views => views.WeekView()) .DataSource(d => d .Model(m => { m.Id(f => f.TimeId); //!!! TimeID should be unique m.Field(f => f.Title).DefaultValue(" "); m.Field(f => f.Start).Editable(true); m.Field(f => f.End).Editable(true); } ) ) ) 
0
source

All Articles