I have a grid in kendo ui with batch editing and I need pass a array to my controller when user clicks update. I have the follow code:
index.jsp:
parameterMap: function(data, type) {
if (type != "read") {
data = data.models;
}
return data;
}
Controller.java:
@Post
@WithoutRoot
public void atualizar(List<MyClassViewModel> vm) {
result.nothing();
}
This way, although the data.models
containing an array of objects that were changed, my List returns empty. How can I do that?
Try using
kendo.stringify
:Not sure if this will fix your issue but I'm also using
batch: true
for my dataSource and this seems to be working for my view models.You probably also want to check Chrome -> Developer Tools -> Network -> Headers-> Request Payload and see how your data is handed over to the server. Your
MyClassViewModel
property names should match exactly what you pass from the client.