Below is the code that i have written. On click of create/update data is not being send to webapi layer and on every click it is calling create operation. Help me to resolve the above issue.
(function ($) {
// Update API url
var UPDATEUSER_API_URL = 'api/UserManagement/PostUpdateUser';
// Delete API url
var DELETEUSER_API_URL = 'api/UserManagement/DeleteUser';
// Search API url
var GETUSER_API_URL = 'api/UserManagement/GetUser';
// Search By Id API url
var GETUSERBYID_API_URL = 'api/UserManagement/GetUserById';
$(function () {
debugger;
dataSource = new kendo.data.DataSource({
transport: {
read: {
url: GETUSER_API_URL,
dataType: "json"
},
update: {
url: UPDATEUSER_API_URL,
contentType: 'application/json;charset=utf-8',
dataType: "json",
type: "PUT"
},
destroy: {
url: DELETEUSER_API_URL,
contentType: 'application/json;charset=utf-8',
type: "DELETE",
dataType: "json",
},
create: {
url: UPDATEUSER_API_URL,
dataType: "json",
type: "POST",
},
parameterMap: function (options, operation) {
if (operation !== "read" && options.models) {
return { models: kendo.stringify(options.models) };
}
}
},
batch: true,
pageSize: 10,
schema: {
model: {
id: "UserProfileID",
fields: {
UserProfileId: { validation: { required: false } },
Password: {type: "string", validation: { required: true } },
Username: { editable: true, validation: { required: true } },
FirstName: {type: "string", validation: { required: true } },
LastName: {type: "string", validation: { required: true } },
EmailId: {type: "string", nullable: false, validation: { required: true } },
IsSuperUser: { type: "boolean", validation: { required: false } },
RoleName: {nullable: false, validation: { required: true } },
}
}
}
});
debugger;
$("#grid").kendoGrid({
dataSource: dataSource,
pageable: true,
height: 400,
toolbar: ["create"],
columns: [
"Username",
{ field: "Password", title: "Password", width: "1px" },
"FirstName",
"LastName",
{ field: "EmailId", title: "Email Id", width: "170px" },
{ field: "IsSuperUser", title: "SuperUser", width: "90px" },
{ field: "RoleName", title: "Roles", width: "90px" },
{ command: ["edit", "destroy"], title: " ", width: "210px" }],
editable: "popup"
});
});
(function ($) {
// Update API url
var UPDATEUSER_API_URL = 'api/UserManagement/PostUpdateUser';
// Delete API url
var DELETEUSER_API_URL = 'api/UserManagement/DeleteUser';
// Search API url
var GETUSER_API_URL = 'api/UserManagement/GetUser';
// Search By Id API url
var GETUSERBYID_API_URL = 'api/UserManagement/GetUserById';
$(function () {
debugger;
dataSource = new kendo.data.DataSource({
transport: {
read: {
url: GETUSER_API_URL,
dataType: "json"
},
update: {
url: UPDATEUSER_API_URL,
contentType: 'application/json;charset=utf-8',
dataType: "json",
type: "PUT"
},
destroy: {
url: DELETEUSER_API_URL,
contentType: 'application/json;charset=utf-8',
type: "DELETE",
dataType: "json",
},
create: {
url: UPDATEUSER_API_URL,
dataType: "json",
type: "POST",
},
parameterMap: function (options, operation) {
if (operation !== "read" && options.models) {
return { models: kendo.stringify(options.models) };
}
}
},
batch: true,
pageSize: 10,
schema: {
model: {
id: "UserProfileID",
fields: {
UserProfileId: { validation: { required: false } },
Password: {type: "string", validation: { required: true } },
Username: { editable: true, validation: { required: true } },
FirstName: {type: "string", validation: { required: true } },
LastName: {type: "string", validation: { required: true } },
EmailId: {type: "string", nullable: false, validation: { required: true } },
IsSuperUser: { type: "boolean", validation: { required: false } },
RoleName: {nullable: false, validation: { required: true } },
}
}
}
});
debugger;
$("#grid").kendoGrid({
dataSource: dataSource,
pageable: true,
height: 400,
toolbar: ["create"],
columns: [
"Username",
{ field: "Password", title: "Password", width: "1px" },
"FirstName",
"LastName",
{ field: "EmailId", title: "Email Id", width: "170px" },
{ field: "IsSuperUser", title: "SuperUser", width: "90px" },
{ field: "RoleName", title: "Roles", width: "90px" },
{ command: ["edit", "destroy"], title: " ", width: "210px" }],
editable: "popup"
});
});