I have a nested grid and am having some issues. In my nested grid I need to allow the user to create a new entry. This works perfectly fine if I don't have a filter for my datasource. If I add one though, when I press "Create Row", nothing happens. No error or message. There is just no new row that is added to the grid. Here is my code:
I don't know what else to try. Thanks for any help.
function
detailInit(e) {
var
detailRow = e.detailRow;
console.log(
"detailRow"
);
console.log(e);
console.log(e.detailRow);
detailRow.find(
".tabstrip"
).kendoTabStrip({
animation: {
open: { effects:
"fadeIn"
}
}
});
detailRow.find(
".AppendLogGrid"
).kendoGrid({
dataSource: {
transport: {
read: {
url: crudServiceBaseUrl +
"api/Logging/GetAllLogAppends"
,
dataType:
"json"
},
update: {
url:
function
(data) {
console.log(
"DATA TEST"
);
console.log(data);
return
crudServiceBaseUrl +
"api/Logging/PutLogAppend"
;
},
dataType:
"json"
,
data:
function
(data) {
console.log(
"returning data in update TEST"
);
console.log(data.models[0]);
return
data.models[0];
},
type:
"PUT"
,
contentType:
"application/json"
,
},
destroy: {
url: crudServiceBaseUrl +
"api/Logging"
,
dataType:
"json"
},
create: {
dataType:
"json"
,
type:
"POST"
,
contentType:
"application/json"
,
url:
function
(data) {
console.log(
"INSIDE CREATE URL"
);
console.log(data);
console.log(data.models[0]);
return
crudServiceBaseUrl +
"api/Logging/PostLogAppend?ParentLogID="
+ e.data.id;
},
data:
function
(data) {
console.log(
"CREATING TEST DATA"
);
console.log(data.models[0]);
return
data.models[0];
}
},
parameterMap:
function
(model, operation) {
if
(operation !==
"read"
&& model) {
return
kendo.stringify(model);
}
else
{
return
kendo.stringify(model);
}
}
},
// filter: { field: "LOG_FK", operator: "eq", value: e.data.id }, THIS IS THE ISSUE!!!!!
batch:
true
,
pageSize: 20,
schema: {
data:
function
(data) {
console.log(
"Log append return data:"
);
console.log(data);
console.log(e.data);
console.log(e.data.$id);
return
data || [];
},
model: {
id:
"Id"
,
fields: {
Id: {
editable:
false
,
nullable:
false
,
type:
"number"
},
Comments: { type:
"string"
},
DateAppended: { type:
"date"
},
Type: { type:
"string"
},
LOG_FK: { type:
"number"
}
}
}
}
},
scrollable:
false
,
sortable:
true
,
pageable:
true
,
toolbar: [
"create"
],
editable:
"inline"
,
columns: [
{ field:
"Id"
, width:
"110px"
},
{ field:
"Comments"
, title:
"Comments"
, width:
"110px"
},
{ command: [
"edit"
,
"destroy"
], title:
" "
, width:
"250px"
}
]
});
}
$(
"#IncidentLoggingGrid"
).kendoGrid({
dataSource: LoggingDS,
columns: [
{ field:
"Comments"
, template:
"<textarea rows='4' cols='40'> </textarea> "
, title:
"Comments"
, format:
"{0:c}"
, width:
"200px"
},
{ command: [
"edit"
,
"destroy"
], title:
" "
, width:
"250px"
}
],
detailTemplate: kendo.template($(
"#AppendLogGridTemplate"
).html()),
detailInit: detailInit,
dataBound:
function
() {
this
.expandRow(
this
.tbody.find(
"tr.k-master-row"
).first());
},
toolbar: [
"create"
],
editable:
"inline"
,
pageable:
true
});
I don't know what else to try. Thanks for any help.