I am using the Kendo grid with Angular and Asp.Net MVC WebApi. I have the grid set up with batch editing and have tried to follow the examples, but I am not getting the data to be updated in my method in the WebApi Controller. I see the data on the update request but when I hit the break point in the method, the parameter has a count of 0. I have tried different scenarios, but have had no luck. Any help is very much appreciated. I have attached screen shots of the parameter at break point and the data on the request in the developer tool in Chrome. Here is my Angular code for the the grid:
Here is the razor code for the grid:
Thanks!
Donna
usersCtrl.authUsersGridOptions = {
pageable:
true
,
selectable:
"row"
,
editable:
true
,
save:
function
(e) {
alert(
"UserFName is "
+ e.model.UserFName);
},
toolbar: [
"save"
,
"cancel"
],
columns: [
{ field:
"Id"
, hidden:
true
},
{ field:
"UserKey"
, hidden:
true
},
{ field:
"UserFName"
, title:
"First Name"
},
{ field:
"UserLName"
, title:
"Last Name"
},
{ field:
"UserName"
, title:
"User Name"
},
{ field:
"Email"
, title:
"Email Address"
},
{
field:
"IsBIUser"
, title:
"Is BI User"
,
template:
'<input type="checkbox" #= IsBIUser ? checked="checked" : "" # disabled="disabled"></input>'
},
{ field:
"StartDate"
, title:
"Start Date"
},
{ field:
"EndDate"
, title:
"End Date"
},
{ field:
"twoFactor"
, hidden:
true
},
{ field:
"mobilePhone"
, hidden:
true
}]
};
usersCtrl.authUsersGridDataSource =
new
kendo.data.DataSource({
type:
"aspnetmvc-ajax"
,
transport: {
read: {
url:
'/api/gmcmembership/au/'
+ e.sender.value(),
dataType:
'json'
,
type:
"GET"
},
update: {
url:
'/api/gmcmembership/updateusers'
,
type:
"POST"
},
parameterMap:
function
(data, operation) {
if
(operation !==
"read"
&& data.models) {
return
{models: kendo.stringify(data.models)}
}
else
{
return
JSON.stringify(data);
}
}
},
schema: {
model: {
id:
"Id"
,
Id:
"Id"
,
UserKey:
"UserKey"
,
UserName:
"UserName"
,
UserFName:
"UserFName"
,
UserLName:
"UserLName"
,
IsBiUser:
"IsBIUser"
,
StartDate:
"StartDate"
,
EndDate:
"EndDate"
,
twoFactor:
"twoFactor"
,
mobilePhone:
"mobilePhone"
}
},
batch:
true
,
pageSize: 7
});
Here is the razor code for the grid:
<
div
ng-show
=
"usersCtrl.showGrid"
kendo-grid
=
"authUsersGrid"
k-options
=
"usersCtrl.authUsersGridOptions"
k-data-source
=
"usersCtrl.authUsersGridDataSource"
>
Thanks!
Donna