Calling create at first time

3 posts, 0 answers
  1. Zdzislaw Ziental
    Zdzislaw Ziental avatar
    30 posts
    Member since:
    Mar 2018

    Posted 11 Jun 2019 Link to this post

    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. Martin
    Admin
    Martin avatar
    258 posts

    Posted 13 Jun 2019 Link to this post

    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.
  3. Zdzislaw Ziental
    Zdzislaw Ziental avatar
    30 posts
    Member since:
    Mar 2018

    Posted 13 Jun 2019 in reply to Martin Link to this post

    Now it's running 100%.
    Thanks a lot for the help.
Back to Top