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

Calling create at first time

2 Answers 18 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
ziental
Top achievements
Rank 1
ziental asked on 11 Jun 2019, 07:37 PM

I'm developing a page where I'm using Sheduler to show some daily activities.
And I noticed strange behavior.

When I change an activity from one day to the next, the script should call update by passing the selected item.
But at the first time it is calling the "create" by passing an array with all the items (including what was modified). Being that of the second time on, it calls the "update" passing only the selected item (desired behavior).

Is this a normal behavior or is it possible to modify to call the update by passing only the item that has been modified at all times?

$("#scheduler").kendoScheduler({
            date: kendo.date.today(),
            footer: false,
            selectable: true,
            timezone: "Etc/UTC",
            views: [
                { type: "week", selected: true }
            ],
            dataSource: {
                batch: true,
                transport: {
                    read: function (e) {                       
                        $.ajax({
                            url: '/Lab/ProductionScheduling/Get_List/',
                            dataType: "json",
                            success: function (result) {
                                e.success(result);
                            },
                            error: function (result) {
                                e.error(result);
                            }
                        });
                    },
                    update: function (e) {
                        console.log('Update...');
                        console.log(e.data);
                        e.success();
                    },
                    destroy: function (e) {
                        console.log('Destroy...');
                        e.success();
                    },
                    create: function (e) {
                        console.log('Create...');
                        console.log(e.data);
                        e.success();
                    }
                },
                schema: {
                    model: {
                        id: "TaskID",
                        fields: {
                            taskId: { from: "TaskID", type: "number" },
                            title: { from: "Title", defaultValue: "No title", validation: { required: true } },
                            start: { type: "date", from: "Start" },
                            end: { type: "date", from: "End" },
                            startTimezone: { from: "StartTimezone" },
                            endTimezone: { from: "EndTimezone" },
                            description: { from: "Description" },
                            recurrenceId: { from: "RecurrenceID" },
                            recurrenceRule: { from: "RecurrenceRule" },
                            recurrenceException: { from: "RecurrenceException" },
                            ownerId: { from: "OwnerID", defaultValue: 1 },
                            isAllDay: { type: "boolean", from: "IsAllDay" }
                        }
                    }
                }
            }
        });

 

In the attached images are the results of operations.
The first time I move a day item (create.png) and the second time I move the item (update.png).

 


2 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 13 Jun 2019, 02:09 PM
Hello Zdzislaw,

Thank you for the provided code and screenshots. The behavior you are experiencing is not normal for the widget, but the issue is not a bug in its implementation. Please follow this link to one of our demos and go to the Network tab in the Browser Inspector. You will see that, upon moving an event, only the update remote call is performed. I compared your code with the code from the demo and I noticed a difference in the model id configuration. Note thet the id configuration should point to a valid field from the fields configuration. Therfore, it should match the "taskId" string:
schema: {
  model: {
    id: "taskId",
    fields: {
      taskId: { from: "TaskID", type: "number" }

If you can't resolve the issue based on the information I shared with you, please send me a sample project which reproduces it. That way I will be able to test it locally and I will try to troubleshoot the problem.

I am looking forward to your reply.

Regards,
Martin
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
ziental
Top achievements
Rank 1
answered on 13 Jun 2019, 03:12 PM
Now it's running 100%.
Thanks a lot for the help.
Tags
Scheduler
Asked by
ziental
Top achievements
Rank 1
Answers by
Martin
Telerik team
ziental
Top achievements
Rank 1
Share this question
or