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

Null reference when updating an event in the scheduler

5 Answers 422 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Support
Top achievements
Rank 1
Support asked on 05 Nov 2013, 01:54 PM
Hello,

We experience a script error randomly when moving events with drag and drop within the scheduler.
The Visual explanation is that the event we have started to move - dont "release" from the mouse and are stuck with the cursor. As you can see in the attached file, the problem occur in the kendo.web.min.js library.

The current configuration run on Win 8.1 , IE11 and on the kendoui.complete.2013.2.918.commercial release.

Our datasource:
  dataSource = new kendo.data.SchedulerDataSource({
        sync: function () {
            this.read();
        },
        batch: true,
        transport: {
            read: {
                url: m_serverUrl + "/ActivityPointerSet",
                dataType: 'json'
            },
            parameterMap: function (options) {
                var parameter = {
                    $filter: filterstring,
                    $select: 'ActivityTypeCode,ActivityId,Subject,ScheduledEnd,ScheduledStart,StatusCode,OwnerId'
                };
 
                return parameter;
            }
 
        },
        schema: {
            model: {
                id: "ActivityId",
                fields: {
                    taskId: { from: "ActivityId" },
                    title: { from: "Subject", defaultValue: "No title", validation: { required: true} },
                    start: { type: "date", from: "ScheduledStart" },
                    end: { type: "date", from: "ScheduledEnd" },
                    //startTimezone: { from: "StartTimezone" },
                    //endTimezone: { from: "EndTimezone" },
                    StatusCode: { from: "StatusCode" },
                    roomId: { from: "ActivityTypeCode" },
                    description: { from: "StatusCode" },
                    recurrenceId: { from: "RecurrenceID" },
                    recurrenceRule: { from: "RecurrenceRule" },
                    recurrenceException: { from: "RecurrenceException" },
                    ownerId: { from: "OwnerId", defaultValue: 1 },
                    isAllDay: { type: "boolean", defaultValue: false }
                }
            },
            parse: function (data) {
                return data.d.results;
            },
            type: "json"
        },
        serverSorting: true,
        serverFiltering: true
    });
 
    return dataSource;
}


The Scheduler initialisation method
function ISV_Abs_InitKendoScheduler() {
    var datasource = ISV_Abs_GetSchedulerDataSource();
 
    $("#scheduler").kendoScheduler({
        date: new Date(),
        editable: {
            confirmation: "Are you sure you want to delete this Sales Call?"
        },
        startTime: new Date("2013/6/13 07:00 AM"),
        navigate: scheduler_navigate,
        remove: scheduler_remove,
        resizeStart: scheduler_resizestart,
        save: scheduler_save,
        moveStart: scheduler_movestart,
        views: [
                "day",
                    { type: "week", selected: true },
                    "month",
                    "agenda"
                ],
        edit: function (e) {
            Xrm.Utility.openEntityForm(e.event.roomId, e.event.taskId, null);
            e.preventDefault();
            return false;
        },
        dataSource: dataSource,
        resources: [
                {
                    field: "roomId",
                    dataSource: [
                        { text: "Sales Call", value: "abs_salescall", color: "#7ea700" },
                        { text: "Appointment", value: "appointment", color: "#0094E5" }
                    ],
                    title: "Activity Type"
                }]
    });
}

function scheduler_movestart(e) {
    if (e.event.description.Value == 2 || e.event.description.Value == 3) {
        alert("Cannot update a canceled or completed Activity");
        e.preventDefault();
        return false;
    }
}

I very happy for any help on this mather.

Best Regards

5 Answers, 1 is accepted

Sort by
0
Support
Top achievements
Rank 1
answered on 05 Nov 2013, 02:16 PM
One important note - I can only recreate it when i drag and drop in "normal" speed , i cannot recreate the issue when i drag and drop very slowly. Could this be a problem related to the force sync?

sync: function () {
 
            this.read();
 
        },
0
Vladimir Iliev
Telerik team
answered on 07 Nov 2013, 09:24 AM
Hi Lotta,

 
Basically your findings that the calling of the read method of the dataSource inside the "sync" event are the source of the issue are correct - the read method create another request to the server and if the user moves the events faster than the time needed for all requests to complete, exception can be thrown. Could you please share more information why you need to call the "read" method on each sync event?

Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Support
Top achievements
Rank 1
answered on 07 Nov 2013, 10:05 AM
Hello Vladimir !

Thank you for your response, i removed the sync method - it was specifically inserted because our assumption of selfupdate was wrong. But unfortunately we still have the same problem.

I attach a screenshot where it break in the file.
0
Rosen
Telerik team
answered on 11 Nov 2013, 07:44 AM
Hi Lotta,

I'm afraid that it is not obvious from the provided information what may be the cause for such error. Therefore, it will be appreciated if you could send us a small runnable sample in which it can be observed locally.
Meanwhile, you may also try the Q3 2013 BETA release (by downloading it from your account) and see if the issue is still exists. 

Regards,
Rosen
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Support
Top achievements
Rank 1
answered on 11 Nov 2013, 09:07 AM
Hi Rosen,

I downloaded the beta version , and commented out these lines of code, now it seem to work.
I Think the onsave method was the cause, and more precise the read method. (  $("#scheduler").data("kendoScheduler").dataSource.read(); )
function scheduler_save(e) {
    e.preventDefault();
    var EntityType = "abs_salescall";
    var salescall = {};
    salescall.ScheduledStart = e.event.start;
    salescall.ScheduledEnd = e.event.end;
 
    if (e.event.roomId != EntityType)
        EntityType = e.event.roomId.charAt(0).toUpperCase() + e.event.roomId.slice(1);
 
    SDK.REST.updateRecord
      (
          e.event.taskId,
          salescall,
          EntityType,
          function () {
              //$("#scheduler").data("kendoScheduler").dataSource.read();
 
          }, SDK.REST.errorHandler);
}

dataSource = new kendo.data.SchedulerDataSource({
     /* sync: function () {
          this.read();
      },*/
      batch: true,
Tags
Scheduler
Asked by
Support
Top achievements
Rank 1
Answers by
Support
Top achievements
Rank 1
Vladimir Iliev
Telerik team
Rosen
Telerik team
Share this question
or