Hi,
I am using the Data Source object to connect to a SharePoint 2013 ODATA source using REST and then use this as the data for a Kendo UI Grid.
The Data Source reads the list correctly and populates the grid, but when I update an item in the Kendo UI Grid the following error is returned by the REST end point.
The property '__deferred' does not exist on type 'SP.SecurableObject'. Make sure to only use property names that are defined by the type.
This is caused by the Data Source returning all the properties from the initial read request and then returning in the update command. SharePoint returns __deferred properties with a REST url to defer loading, but is throwing a wobbly if they are returned back in an update command.
Below is my Data Source
Any idea what I can do to only return the fields that are updateable.
Cheers
I am using the Data Source object to connect to a SharePoint 2013 ODATA source using REST and then use this as the data for a Kendo UI Grid.
The Data Source reads the list correctly and populates the grid, but when I update an item in the Kendo UI Grid the following error is returned by the REST end point.
The property '__deferred' does not exist on type 'SP.SecurableObject'. Make sure to only use property names that are defined by the type.
This is caused by the Data Source returning all the properties from the initial read request and then returning in the update command. SharePoint returns __deferred properties with a REST url to defer loading, but is throwing a wobbly if they are returned back in an update command.
Below is my Data Source
01.
var
dataSource =
new
kendo.data.DataSource({
02.
type:
"odata"
,
03.
transport: {
04.
read: {
05.
url: listUrl,
06.
type:
"GET"
,
07.
dataType:
"json"
,
08.
contentType:
"application/json;odata=verbose"
,
09.
headers: {
10.
"accept"
:
"application/json;odata=verbose"
11.
}
12.
},
13.
create: {
14.
url: listUrl,
15.
type:
"POST"
,
16.
dataType:
"json"
,
17.
contentType:
"application/json;odata=verbose"
,
18.
headers: {
19.
"accept"
:
"application/json;odata=verbose"
,
20.
"X-RequestDigest"
: $(
"#__REQUESTDIGEST"
).val(),
21.
}
22.
},
23.
update: {
24.
url:
function
(data) {
25.
return
listUrl +
"("
+ data.ID +
")"
;
26.
},
27.
beforeSend:
function
(jqXhr, options) {
28.
29.
var
data = JSON.parse(options.data);
30.
31.
jqXhr.setRequestHeader(
"If-Match"
, data.__metadata.etag);
32.
33.
},
34.
type:
"POST"
,
35.
dataType:
"json"
,
36.
contentType:
"application/json;odata=verbose"
,
37.
headers: {
38.
"accept"
:
"application/json;odata=verbose"
,
39.
"X-RequestDigest"
: $(
"#__REQUESTDIGEST"
).val(),
40.
"X-HTTP-Method"
:
"MERGE"
41.
},
42.
},
43.
destroy: {
44.
url:
function
(data) {
45.
return
listUrl +
"("
+ data.ID +
")"
;
46.
},
47.
type:
"DELETE"
,
48.
dataType:
"json"
,
49.
contentType:
"application/json;odata=verbose"
,
50.
headers: {
51.
"accept"
:
"application/json;odata=verbose"
,
52.
"X-RequestDigest"
: $(
"#__REQUESTDIGEST"
).val(),
53.
"X-HTTP-Method"
:
"MERGE"
,
54.
"If-Match"
:
"*"
55.
}
56.
}
57.
},
58.
pageSize: 20,
59.
schema: {
60.
data:
"d.results"
,
61.
model: {
62.
id:
"ID"
,
63.
fields: {
64.
ID: { editable:
false
, nullable:
false
},
65.
Title: { validation: { required:
true
} },
66.
Body1: { validation: { required:
true
} },
67.
Votes: { type:
"number"
, validation: { required:
true
, min: 1 } },
68.
}
69.
}
70.
}
71.
});
Cheers