How to handle the custom server response correctly after updating?
I have the one strange problem.
Server returns List<MyDto> and this information are displayed in the grid.
Grid has two columns "name" and "user name".
Where the first column is just noneditable cell and the second column is dropdownlist cell, where I can change an user.
Grid has an "inline" editable mode.
My update js code looks like
I have the one strange problem.
Server returns List<MyDto> and this information are displayed in the grid.
class MyDto{ String name; Guid id; String userName; Guid userId;}Grid has two columns "name" and "user name".
Where the first column is just noneditable cell and the second column is dropdownlist cell, where I can change an user.
Grid has an "inline" editable mode.
My update js code looks like
update: { url: "api/linkUser", method: 'POST', complete: function(e) { refreshGrid(); }},parameterMap: function (options, operation) { if (operation !== "read" && options.models) { var data = {}; data.Id = JSON.parse(JSON.stringify(options.models))[0].Id; data.UserId = JSON.parse(JSON.stringify(options.models))[0].UserId; return data; }},
Server method:
public Result linkUser(Guid id, Guid userId)
{
bool result = CheckAndSave(id, userId);
if(result)
{
return new Result(true, "Success!");
}
else
{
return new Result(false, "Error!");
}
}
So I 'd like to handle result on client side and show notification if I get an error.
But on client-side I get "​Uncaught SyntaxError: Unexpected token u" and update-complete function does not called.
What's problem? How to supress this error? May be there is a workaround?
Thanks in advance.