The GridBlazor component installation is straightforward. Just follow these steps:
Create a new Blazor client-side solution using the Blazor WebAssembly App template
Install the GridBlazor nuget package v1.5.0 or lateron the client project.
Install the Microsoft.AspNetCore.OData nuget package v7.4.0 or later on the server project.
Add the following lines to the wwwroot/index.html file:
<link href="_content/GridBlazor/css/gridblazor.min.css" rel="stylesheet" />
<script src="_content/GridBlazor/js/gridblazor.js"></script>
These files will be loaded from the GridBlazor nuget package, so it is not necessary to copy it to you project.
If you are using Boostrap 3.x you will also need this line in the wwwroot/index.html file:
<link href="~/_content/GridBlazor/css/gridblazor-bootstrap3.min.css" rel="stylesheet" />
Add the OData endpoints in Startup.cs file of the server project:
app.UseEndpoints(endpoints =>
{
endpoints.Select().Expand().Filter().OrderBy().MaxTop(100).Count();
endpoints.MapODataRoute("odata", "odata", EdmModel.GetEdmModel());
endpoints.MapControllers();
endpoints.MapFallbackToFile("index.html");
});
It's important to enable Select
, Expand
, Filter
, and OrderBy
operations at application level or at controller level.
More information in the Microsoft OData dcoumentation.
If you use another OData server implementation for the back-end you should read the providers documentation to configure the back-end project.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。