Hello,
I am trying to get Kendo Grid to make a RESTful call after performing an in-line row edit. The call happens but it doesn't successfully make it's way to my spring-boot end-point, I keep getting a 400 Bad Request.
[KENDO CODE]
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "/customers",
type: 'GET',
dataType: "json"
},
update: {
url: "/customers/update",
type: 'PUT',
contentType: "application/json",
dataType: "json"
},
destroy: {
url: "/customers/destroy",
dataType: "json"
},
create: {
url: "/customers/create",
dataType: "json"
},
parameterMap: function(options, operation) {
if (operation !== "read" && options.models) {
return {models : kendo.stringify(options.models)};
}
}
},
batch: true,
pageSize: 20,
schema: {
model: {
id: "id",
fields: myFields
}
}
});
$("#grid").kendoGrid({
dataSource: dataSource,
height: 550,
groupable: true,
sortable: true,
editable: true,
filterable: {
extra: false,
operators: {
string: {
startswith: "Starts with",
eq: "Is equal to",
neq: "Is not equal to"
}
}
},
pageable: {
refresh: true,
pageSizes: true,
buttonCount: 5
},
toolbar: ["create", "save", "cancel"],
columns: myColumns
});
[SPRING-BOOT CODE]
@RestController
@RequestMapping(value="/customers")
public class CustomerRestController {
@RequestMapping(value="/update", method = RequestMethod.PUT)
public @ResponseBody List<Customer> update(@RequestBody List<Customer> cust) {
...
}
}
[THE ERROR]
251{"timestamp":1426123694014,"status":400,"error":"Bad Request","exception":"org.springframework.http.converter.HttpMessageNotReadableException","message":"Could not read JSON: Unrecognized token 'models': was expecting ('true', 'false' or 'null')\n at [Source: org.apache.catalina.connector.CoyoteInputStream@735e34; line: 1, column: 8]; nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'models': was expecting ('true', 'false' or 'null')\n at [Source: org.apache.catalina.connector.CoyoteInputStream@735e34; line: 1, column: 8]","path":"/customers/update"}0
I am trying to get Kendo Grid to make a RESTful call after performing an in-line row edit. The call happens but it doesn't successfully make it's way to my spring-boot end-point, I keep getting a 400 Bad Request.
[KENDO CODE]
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "/customers",
type: 'GET',
dataType: "json"
},
update: {
url: "/customers/update",
type: 'PUT',
contentType: "application/json",
dataType: "json"
},
destroy: {
url: "/customers/destroy",
dataType: "json"
},
create: {
url: "/customers/create",
dataType: "json"
},
parameterMap: function(options, operation) {
if (operation !== "read" && options.models) {
return {models : kendo.stringify(options.models)};
}
}
},
batch: true,
pageSize: 20,
schema: {
model: {
id: "id",
fields: myFields
}
}
});
$("#grid").kendoGrid({
dataSource: dataSource,
height: 550,
groupable: true,
sortable: true,
editable: true,
filterable: {
extra: false,
operators: {
string: {
startswith: "Starts with",
eq: "Is equal to",
neq: "Is not equal to"
}
}
},
pageable: {
refresh: true,
pageSizes: true,
buttonCount: 5
},
toolbar: ["create", "save", "cancel"],
columns: myColumns
});
[SPRING-BOOT CODE]
@RestController
@RequestMapping(value="/customers")
public class CustomerRestController {
@RequestMapping(value="/update", method = RequestMethod.PUT)
public @ResponseBody List<Customer> update(@RequestBody List<Customer> cust) {
...
}
}
[THE ERROR]
251{"timestamp":1426123694014,"status":400,"error":"Bad Request","exception":"org.springframework.http.converter.HttpMessageNotReadableException","message":"Could not read JSON: Unrecognized token 'models': was expecting ('true', 'false' or 'null')\n at [Source: org.apache.catalina.connector.CoyoteInputStream@735e34; line: 1, column: 8]; nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'models': was expecting ('true', 'false' or 'null')\n at [Source: org.apache.catalina.connector.CoyoteInputStream@735e34; line: 1, column: 8]","path":"/customers/update"}0