Hello,
I'm using Kendo grid with CRUD functionality. The problem is, the first create functionality works fine but when I want to add another data then i get:
This is the response from server that is a Json file:
This is the code in the view:
$("#rulesTable").kendoGrid({
columns: [
{ field: "UserName", title: "UserName", width: "300px" },
{ field: "Path", title: "Path" },
{ command: ["destroy"], title: " ", width: "200px" }
],
editable: "popup",
pageable: true,
toolbar: ["create"],
dataSource: {
serverPaging: true,
pageSize: 10,
schema: {
data: "Data",
total: "Total",
model: {
id: "Id",
fields: {
UserName: { type: "string", editable: true, nullable: false, validation: { required: true } },
Path: { type: "string", editable: true, nullable: false, validation: { required: true } }
},
}
},
batch: true,
transport: {
create: {
url: "Rules/AddRule1",
type: "POST",
},
read: {
url: "Rules/GetRules",
contentType: "application/json; charset=utf-8",
type: "POST",
dataType: "json",
},
destroy: {
url: "Rules/DeleteRule1",
type: "POST",
data: {
Id: $("#input").val()
},
},
errors: function (response) {
var errorData = $.parseJSON(e.responseText);
alert(errorData.errorMessage);
$("#loading").innerHtml = "error";
},
parameterMap: function (data, operation) {
if (operation === "read") {
return kendo.stringify(data);
}
else {
var result = {};
for (var member in data) {
result["" + member] = data[member];
}
return result;
}
}
},
sort:
{
field: "UserName",
dir: "asc"
},
},
});
Could you please help me why i get this error?
I'm using Kendo grid with CRUD functionality. The problem is, the first create functionality works fine but when I want to add another data then i get:
TypeError: d is undefined
in Firebug and I cannot even close the create dialog. This is the response from server that is a Json file:
{"Data":[{"Id":364,"UserName":"a","Path":"a","PathEscaped":"a\\%"},{"Id":365,"UserName":"b","Path":"b"
,"PathEscaped":"b\\%"}],"Total":2,"AggregateResults":null,"Errors":null}
This is the code in the view:
$("#rulesTable").kendoGrid({
columns: [
{ field: "UserName", title: "UserName", width: "300px" },
{ field: "Path", title: "Path" },
{ command: ["destroy"], title: " ", width: "200px" }
],
editable: "popup",
pageable: true,
toolbar: ["create"],
dataSource: {
serverPaging: true,
pageSize: 10,
schema: {
data: "Data",
total: "Total",
model: {
id: "Id",
fields: {
UserName: { type: "string", editable: true, nullable: false, validation: { required: true } },
Path: { type: "string", editable: true, nullable: false, validation: { required: true } }
},
}
},
batch: true,
transport: {
create: {
url: "Rules/AddRule1",
type: "POST",
},
read: {
url: "Rules/GetRules",
contentType: "application/json; charset=utf-8",
type: "POST",
dataType: "json",
},
destroy: {
url: "Rules/DeleteRule1",
type: "POST",
data: {
Id: $("#input").val()
},
},
errors: function (response) {
var errorData = $.parseJSON(e.responseText);
alert(errorData.errorMessage);
$("#loading").innerHtml = "error";
},
parameterMap: function (data, operation) {
if (operation === "read") {
return kendo.stringify(data);
}
else {
var result = {};
for (var member in data) {
result["" + member] = data[member];
}
return result;
}
}
},
sort:
{
field: "UserName",
dir: "asc"
},
},
});
Could you please help me why i get this error?