This example binds the DevExpress Blazor Grid UI component to an OData Instant Feedback data source. The data source retrieves records on demand in background threads to maintain app responsiveness. It reduces memory consumption and improves overall performance when working with large collections.
Note: Instant Feedback data sources impose limitations on available Grid features. Refer to the following topic for additional information in this regard: Bind Blazor Grid to Server Mode Data Sources.
- Run the ODataServer application.
- Run the InstantFeedback application.
InstantFeedback connects to ODataServer at https://localhost:5006/odata. If port 5006 is already in use, update URLs in Program.cs and OrdersContext.cs.
In this example, the DevExpress Blazor Grid retrieves data from an OData service. To bind our Blazor Grid component to this type of service, you must:
-
Add the following NuGet package to your project: Microsoft.OData.Client
-
Create data model and service context classes.
-
Add required namespaces to the page that hosts the Grid:
@using InstantFeedback.Models @using DevExpress.Data.ODataLinq
-
Create an ODataInstantFeedbackSource instance, configure connection parameters, and assign the instance to the Grid's Data property:
<DxGrid Data="ODataSource"> <!-- ... --> </DxGrid> @code { ODataInstantFeedbackSource ODataSource { get; set; } protected override void OnInitialized() { ODataSource = new ODataInstantFeedbackSource(); ODataSource.KeyExpression = "OrderId"; ODataSource.GetSource += (sender, e) => e.Query = new OrdersContext().Orders; } }
-
Implement the IDisposable interface and dispose of the data source in the page's Dispose method:
@implements IDisposable // ... @code { //... public void Dispose() { ODataSource?.Dispose(); } }
InstantFeedback:
ODataServer:
(you will be redirected to DevExpress.com to submit your response)
