We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

CustomAdaptor does not work with Grid - TValue="ExpandoObject"

Thread ID:

Created:

Updated:

Platform:

Replies:

150957 Jan 25,2020 05:05 PM UTC Jan 28,2020 03:41 AM UTC Blazor 3
loading
Tags: Grid
Brice FROMENTIN
Asked On January 25, 2020 05:05 PM UTC

Hi,

I try to make a custom adaptor with a ExpandoObeject grid but with no success, please note that it works with Adaptor="Adaptors.WebApiAdaptor"

here is the code :

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.


Vignesh Natarajan [Syncfusion]
Replied On January 27, 2020 12:12 PM UTC

 
Thanks for contacting Syncfusion support.  
 
Query: “I try to make a custom adaptor with a ExpandoObeject grid but with no success, please note that it works with Adaptor="Adaptors.WebApiAdaptor" 
 
We are able to reproduce the reported behavior at our end while preparing a sample using your code example. Kindly modify your code example as below to resolve your issue.  
 
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; 
       } 
 
For your convenience we have prepared a sample which can be downloaded from below    
 
 
Please get back to us if you have further queries.   
 
Regards,
Vignesh Natarajan.
 
 


Brice FROMENTIN
Replied On January 27, 2020 05:24 PM UTC

Thanks, it works perfectly.

Vignesh Natarajan [Syncfusion]
Replied On January 28, 2020 03:41 AM UTC

Hi Brice,  
 
Thanks for the update.  
 
We are glad to hear that you are able to resolve your query using our solution.  
 
Kindly get back to us if you have further queries.  
 
Regards, 
Vignesh Natarajan.  


CONFIRMATION

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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon