Hello everybody,
I have a problem on the editing popup in the Grid widget. Based on the guide, I modified the example code in order to to only accept READ and CREATE operations:
<script>
$(document).ready(
function
() {
var
dataSource =
new
kendo.data.DataSource({
transport: {
read: {
url:
'@Url.Action("GetAssignations", "Tasks")'
+
'/'
+
'@Model.IdProject'
,
dataType:
"json"
,
type:
'GET'
},
create: {
url:
'@Url.Action("CreateAssignation", "Tasks")'
,
dataType:
"json"
,
type:
'POST'
,
contentType:
"application/json"
},
parameterMap:
function
(options, operation) {
if
(operation !==
"read"
&& options.models) {
var
output =
""
;
$.each(options.models,
function
(index, value) {
console.log(value);
output = value;
});
return
kendo.stringify(output);
}
}
},
batch:
true
,
pageSize: 20,
schema: {
model: {
id:
"idAssignation"
,
fields: {
idProject: { type:
"number"
, defaultValue:
function
() {
return
@Model.IdProject} },
assignee: { type:
"string"
},
addedOn: { type:
"date"
, editable:
false
}
}
}
}
});
$(
"#grid"
).kendoGrid({
dataSource: dataSource,
pageable:
true
,
//height: 550,
toolbar: [
"create"
],
columns: [
{ field:
"assignee"
, title:
"Assignee"
},
{ field:
"addedOn"
, title:
"Added on"
},
],
editable:
"popup"
});
});
</script>
Both READ and CREATE work because the data are correctly read/written into database; however, after the POST the editing popup does not disappear.
Could you give me some help?
Thanks in advance.
Filippo