Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
150957 | Jan 25,2020 05:05 PM UTC | Jan 28,2020 03:41 AM UTC | Blazor | 3 |
![]() |
Tags: Grid |
<EjsGrid TValue="ExpandoObject" AllowResizing="true" AllowPaging="true" Width="100%" Height="100%"> <GridPageSettings PageSize="50" /> <EjsDataManager Adaptor="Adaptors.CustomAdaptor"> <OdqDataAdaptor Url="odata/configurations/00000000-0000-0000-0000-000000000000/data/"></OdqDataAdaptor> </EjsDataManager> <GridColumns> <GridColumn Field="Id" HeaderText="Order ID" IsPrimaryKey=true TextAlign="TextAlign.Right" Width="120"></GridColumn> <GridColumn Field="Description" HeaderText="Description" Width="auto"></GridColumn> <GridColumn Field="Date" HeaderText="Order Date" Format="yMd" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn> <GridColumn Field="Freight" HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn> </GridColumns> </EjsGrid> |
Custom Adaptor :
@using Syncfusion.EJ2.Blazor; @using Syncfusion.EJ2.Blazor.Data; @using Kairos.Models.Odq; @inherits DataAdaptor<object> @inject HttpClient httpClient <CascadingValue Value="@this"> @ChildContent </CascadingValue> @code { [Parameter] public RenderFragment ChildContent { get; set; } [Parameter] public string Url { get; set; } public override async Task<object> ReadAsync(DataManagerRequest dataManagerRequest, string key = null) { var restClient = new RestClient(httpClient); var result = await restClient.GetAsync<OdqFromConfigurationModel>(this.Url); return new DataResult<ExpandoObject>() { Count = result.Count, Result = result.Items }; } } |
Thanks.
public override async Task<object> ReadAsync(DataManagerRequest dataManagerRequest, string key = null)
{
result = await Service.GetOrdersAsync();
return dm.RequiresCounts ? new DataResult() { Result = result, Count = count } : (object)DataSource;
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.