My grid is not binding whenever a read is made. I programmed it so that when the user presses a button, it gathers search parameters and calls the read() method. It fetches the data and I get results successfully, but it doesn't update in the UI, no loading graphic or anything. I can see the grid but it has no data. I simplified the fields and columns to only one to see if there was an error in the naming but no luck. No console errors. I used tag helper and HTML helper, none work. Below is my code, simplified for this post.
Razor Page
<head>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link href="~/lib/kendo-ui/styles/kendo.bootstrap-main.min.css" rel="stylesheet" type="text/css" />
<script src="~/lib/kendo-ui/js/jquery.min.js"></script>
<script src="~/lib/kendo-ui/js/jszip.min.js"></script>
<script src="~/lib/kendo-ui/js/kendo.all.min.js"></script>
<script src="~/lib/kendo-ui/js/kendo.aspnetmvc.min.js"></script>
</head>
<body>
@inject Microsoft.AspNetCore.Antiforgery.IAntiforgery Xsrf
@Html.AntiForgeryToken()
<button type="button" id="btnSearch" onclick="SearchPosInfo()">Search</button>
<kendo-grid name="grdResults" auto-bind="false">
<datasource type="DataSourceTagHelperType.Ajax" page-size="25">
<schema>
<model id="piid">
<fields>
<field name="piid" type="number"></field>
</fields>
</model>
</schema>
<transport>
<read url="Index?handler=Read" data="SearchParams" />
</transport>
</datasource>
<columns>
<column field="piid"></column>
</columns>
<sortable enabled="true" />
<pageable button-count="5" page-sizes="new int[] { 10, 25, 50, 100 }">
</pageable>
</kendo-grid>
.
.
.
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
</body>
JS
function SearchParams() {
var searchParams = {
pd: $("#txtNumber").val()
}
var ext = $.extend(true, {}, kendo.antiForgeryTokens(), searchParams);
return ext;
}
function SearchPosInfo() {
$("#grdResults").data("kendoGrid").dataSource.read();
}
Response
{"data":[{"piid":37133},{"piid":37525},{"piid":48314},{"piid":56042}],"total":4,"aggregateResults":null,"errors":null}