I am trying to use KendoDataSource with datatype webapi.
Create request post DataSourceRequest and viewmodel to server but datasource request property not bind, viewmodel data passed
I can normally move the DataSourceRequest and viewmodel like this to the ajax call with type: "aspnetmvc-ajax" but when type:"webapi" not bind request property bind
Thanks a lot.
<a href="https://ibb.co/j5FT5w" rel="nofollow noreferrer">SS</a>
var dataSourceExperiences = new kendo.data.DataSource({
type: "webapi",
serverPaging: true,
serverFiltering: true,
serverSorting: true,
page: 1,
pageSize: 7,
schema: {
data: "Data",
total: "Total",
model: {
id: "Id",
fields: {
CompanyName: { type: "string" },
Description: { type: "string" },
WorkTypeName: { type: "string" },
PositionHeldId: { type: "number" },
PositionHeldName: { type: "string" },
WorkTypeId: { type: "number" },
StartDate: { type: "date" },
EndDate: { type: "date" },
Explanation: { type: "string" },
CountryId: { type: "number" },
CountryName: { type: "string" },
CityId: { type: "number" },
CityName: { type: "string" },
EmployeeId: { type: "number" },
}
}
},
transport: {
read: {
url: baseApiUrl + 'api/Experience/ReadExperience',
type: "GET",
beforeSend: function (req) {
req.setRequestHeader("Authorization", "Bearer " + '@Model');
},
},
create: {
url: baseApiUrl + "api/Experience/CreateExperience",
type: "GET",
beforeSend: function (req) {
req.setRequestHeader("Authorization", "Bearer " + '@Model');
},
}
},
});
var dataGrid = $("#dataGrid").kendoGrid({
dataSource: dataSourceExperiences,
autoBind: false,
sortable: true,
scrollable: true,
columns: [
{
field: "PositionHeldName",
title:"PositionHeldName",
filterable: true
},
{
field: "CompanyName",
title: "CompanyName"
},
{
field: "WorkTypeName",
title: "WorkTypeName"
},
{
field: "CountryName",
title: "CountryName"
},
{
field: "CityName",
title: "CityName"
},
],
selectable: "row"
}).data("kendoGrid");