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

problems in the update and delete methods

6 Answers 133 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Rodrigo
Top achievements
Rank 1
Rodrigo asked on 28 Aug 2013, 03:59 PM
I tried to call the update and delete methods and always enters the created.
it can be?
<script>
    $(function () {
        $("#scheduler").kendoScheduler({
            date: new Date("2013/1/1"),
            startTime: new Date("2013/1/1 07:00 AM"),
            height: 600,
            views: [
            "day",
                { type: "month", selected: true },
                "month",
                "agenda"
            ],
            timezone: "Etc/UTC",
            //editable: { template: kendo.template($("#schedulerTemplate").html()) },
 
            dataSource: {
                batch: true,
                transport: {
                    read: {
                        url: "/Home/CalendarioCargar",
                        dataType: "jsonp"
                    },
                    update: {
                        url: "/Home/CalendarioUpdate",
                        dataType: "json"
                    },
                    create: {
                        url: "/Home/CalendarioAdd",
                        dataType: "json"
                    },
                    destroy: {
                        url: "/Home/CalendarioRemove",
                        dataType: "jsonp",
                         
                    },
                    parameterMap: function (options, operation) {
                        if (operation !== "read" && options.models) {
                            return { models: kendo.stringify(options.models) };
                        }
                    }
                },
                
                schema: {
                    model: {
                        id: "TaskID",
                        fields: {
                            taskId: { from: "TaskID", type: "number" },
                            title: { from: "Title", defaultValue: "No title", validation: { required: true } },
                            start: { type: "date", from: "FechaIni" },
                            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" }
                        }
                    }
                },
                filter: {
                    logic: "or",
                    filters: [
                        { field: "ownerId", operator: "eq", value: 1 },
                        { field: "ownerId", operator: "eq", value: 2 }
                    ]
                }
            },
            resources: [
                {
                    field: "ownerId",
                    title: "Owner",
                    dataSource: [
                        { text: "Alex", value: 1, color: "#f8a398" },
                        { text: "Bob", value: 2, color: "#51a0ed" },
                        { text: "Charlie", value: 3, color: "#56ca85" }
                    ]
                }
            ]
        });
 
        $("#people :checkbox").change(function (e) {
            var checked = $.map($("#people :checked"), function (checkbox) {
                return parseInt($(checkbox).val());
            });
 
            var filter = {
                logic: "or",
                filters: $.map(checked, function (value) {
                    return {
                        operator: "eq",
                        field: "ownerId",
                        value: value
                    };
                })
            };
 
            var scheduler = $("#scheduler").data("kendoScheduler");
 
            scheduler.dataSource.filter(filter);
        });
    });
</script>

6 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 29 Aug 2013, 11:08 AM
Hi Rodrigo,

The most common case in which such behavior may occur is due to missing or incorrect configuration of ID field of the event data. Therefore, could you verify that data returned by the server, does contain a TaskID field (as described in the provided schema declaration) and it is correctly populated. 

Regards,
Rosen
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Rodrigo
Top achievements
Rank 1
answered on 29 Aug 2013, 11:20 AM
Hello.
this is what receives kendo

 

jQuery191040567935743605143_1377774830288([{"TaskID":1,"Title":"reyes","Description":"regalos de reyes","End":"\/Date(1357430400000)\/","StartTimezone":"","EndTimezone":"","RecurranceId":null,"RecurranceException":null,"IsAllDay":true,"OwnerID":1,"FechaIni":"\/Date(1357344000000)\/"},{"TaskID":2,"Title":"fiesta","Description":"fin de año","End":"\/Date(1357084800000)\/","StartTimezone":null,"EndTimezone":null,"RecurranceId":null,"RecurranceException":null,"IsAllDay":true,"OwnerID":1,"FechaIni":"\/Date(1356998400000)\/"},{"TaskID":3,"Title":"otra mas","Description":"5r34543534","End":"\/Date(1358985600000)\/","StartTimezone":"","EndTimezone":"","RecurranceId":null,"RecurranceException":null,"IsAllDay":true,"OwnerID":1,"FechaIni":"\/Date(1358899200000)\/"}]);
0
Rosen
Telerik team
answered on 29 Aug 2013, 11:36 AM
Hi Rodrigo,

Looking at the schema definition it seems that the id declaration is incorrect. It should be the name of the field to which the original one is mapped thus it should be taskId (with lower T and D) instead of TaskID.

model: {
    id: "taskId",
    fields: {
        taskId: { from: "TaskID", type: "number" },
        //....
    }
}



Regards,
Rosen
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Rodrigo
Top achievements
Rank 1
answered on 29 Aug 2013, 11:42 AM
when you tell me, I've changed and I was checking.
thanks
0
Rodrigo
Top achievements
Rank 1
answered on 29 Aug 2013, 11:50 AM
one more question.
they have to return the service to display the message and cierrer ko ko or the window?
thansk
0
Rosen
Telerik team
answered on 30 Aug 2013, 07:50 AM
Hello Rodrigo,

I'm afraid that I do not understand your question. Could you please clarify?

Regards,
Rosen
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Scheduler
Asked by
Rodrigo
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Rodrigo
Top achievements
Rank 1
Share this question
or