0
我有一個從遠程API填充的Kendo UI網格。發送Kendo網格數據到Web API方法
當我點擊界面上的「保存更改」按鈕時,我希望它將數據模型傳遞給API。
但是,在我的代碼下面的更新聲明中,我得到一個「JavaScript運行時錯誤:Expected';'「錯誤。 但是,我看不到是什麼導致了這個錯誤。
任何想法,我在這裏失蹤,以便我可以將網格數據傳遞給API?
var crudServiceBaseUrl = apiurl + "calendar/",
dataSource = new kendo.data.DataSource({
transport: {
read: {
url: crudServiceBaseUrl + "/GetCalendars",
dataType: "json" // "jsonp" is required for cross-domain requests; use "json" for same-domain requests
},
update: function (myData) {
$.ajax({
url: crudServiceBaseUrl + "/UpdateCalendar",
dataType: "json",
contentType: "application/json",
type: "POST",
data: {
models: JSON.stringify(myData.data.models)
}
});
},
destroy: {
url: crudServiceBaseUrl + "/Products/Destroy",
dataType: "jsonp"
},
create: {
url: crudServiceBaseUrl + "/Products/Create",
dataType: "jsonp"
},
parameterMap: function (options, operation) {
if (operation !== "read" && options.models) {
return { models: kendo.stringify(options.models) };
}
}
},
batch: true,
//pageSize: 20,
schema: {
model: {
id: "CalendarName",
fields: {
CalendarName: { editable: true, nullable: false },
Monday: { type: "boolean" },
Tuesday: { type: "boolean" },
Wednesday: { type: "boolean" },
Thursday: { type: "boolean" },
Friday: { type: "boolean" },
Saturday: { type: "boolean" },
Sunday: { type: "boolean" }
}
}
}
});
補充說,但同樣的錯誤。 – Kevin