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

Sending parameters to controller

1 Answer 275 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
corey
Top achievements
Rank 1
corey asked on 12 Aug 2013, 07:43 PM
I am confused on how to send the save data to an outside controller. Im using kendo for html.   Here is my code for the scheduler. How could I send the data from a save to a controller. 
Thanks

$("#scheduler").kendoScheduler({
                date: new Date("2013/6/13"),
                startTime: new Date("2013/6/13 07:00 AM"),
                height: 600,
                views: [
                "day",
                    { type: "week", selected: true },
                    "month",
                    "agenda"
                ],
                timezone: "Etc/UTC",
                save: scheduler_save,
                remove: scheduler_remove,
                edit: scheduler_edit,
                cancel: scheduler_cancel,
                dataSource: {
                    batch: true,
                    transport: {
                        read: {
                            url: "/Team/Calendar/PopulateCalendar/",
                            dataType: "json",
                            
                        },
                        //update: {
                        //    url: "/Team/Calendar/UpdateAppointment/",
                        //    dataType: "json"
                        //},
                        //create: {
                        //    url: "/Team/Calendar/CreateAppointment/",
                        //    dataType: "json"
                        //},
                        //destroy: {
                        //    url: "http://demos.kendoui.com/service/tasks/destroy",
                        //    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: "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" }
 
                            }
                        }
                         
                    },
                     
                    resources: [
                        {
                            field: "ownerId",
                            title: "Owner",
                            dataSource: [
                                { text: "Alex", value: 1, color: "#f8a398" },
                                { text: "Bob", value: 2, color: "#51a0ed" },
                                { text: "Charlie", value: 3, color: "#56ca85" }
                            ]
                        }
                    ]
                }
            })
        });

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 13 Aug 2013, 10:29 AM
Hello,

 This can be done by extending the parameterMap function:

parameterMap: function (options, operation) {
                            if (operation !== "read" && options.models) {
                                return {
                                  models: kendo.stringify(options.models),
                                  value: "MyValue"
                                };
                            }
                        }

Regards,
Atanas Korchev
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
corey
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or