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

EjsGrid behavior change with fully dynamyc dataset

Thread ID:

Created:

Updated:

Platform:

Replies:

150573 Jan 11,2020 05:09 PM UTC Jan 27,2020 05:15 AM UTC Blazor 5
loading
Tags: Grid
Brice FROMENTIN
Asked On January 11, 2020 05:09 PM UTC

Using 17.3 before, I can construct a grid like this :

<EjsGrid ID=@("odqGrid" + Parameters.Identifier) @ref=@grid TValue="object" AllowPaging="true" AllowResizing=true Width="100%" Height="100%">
    <GridEvents TValue="object" RowSelected="OnRowSelectedHandler" OnRecordDoubleClick="OnDoubleClickHandler"></GridEvents>
    <GridPageSettings PageSize="25" />
    <EjsDataManager Url=@(RestClient.RootUrl + "odata/configurations/00000000-0000-0000-0000-000000000000/data/") Adaptor="Adaptors.WebApiAdaptor"></EjsDataManager>
    <GridColumns>
        @foreach (var field in this.Parameters.CurrentConfiguration.DisplayFields)
        {
            <GridColumn HeaderText=@field.DisplayName
                        Field=@field.DataName
                        Format=@(field.Format ?? "")
                        IsPrimaryKey=@field.IsPrimaryKey
                        Width=@field.Width
                        Visible=@field.Visible />
        }
    </GridColumns>
</EjsGrid>

I used the TValue to object and the grid was kind enough to take a look to the field name of the datasource to make the databind. Witth the 17.4.x version supports this scenario ?

Regards.

Vignesh Natarajan [Syncfusion]
Replied On January 13, 2020 03:53 PM UTC

Hi Brice,  
 
Thanks for contacting Syncfusion support.  
 
Query:” I used the TValue to object and the grid was kind enough to take a look to the field name of the datasource to make the databind. With the 17.4.x version supports this scenario ? 
 
After our 2019 Volume 4 release (17.4.0.39), TValue must be Generic Type. Tvalue must be type of business object instead of dynamic/object when using remote data. In our source, we use HttpClient to sent request to server to fetch data from it. So we have deserialized the data based on the TValue object. So kindly use business object type TValue to resolve the query.  
 
Or If you still want to use Dynamic object with remote data, then we suggest you to external methods like getJsonAsync of HttpClient to fetch data from server and bind to Grid using ExpandoObject. Refer the below code example.  
 
<EjsGrid @ref=@grid TValue="ExpandoObject" DataSource="@Orders" AllowPaging="true" AllowResizing=true Width="100%" Height="100%"> 
     . . . . . . . . . . .  
</EjsGrid> 
 
@code{ 
    EjsGrid<ExpandoObject> grid { get; set; } 
    public List<ExpandoObject> Orders { get; set; } 
    protected override async Task OnInitializedAsync() 
    { 
        Orders = await OrderData.GetStudentsAsync(); 
    } 
}. . . . . . . . 
public async Task<List<ExpandoObject>> GetStudentsAsync() 
        { 
            HttpClient http = new HttpClient();             
            var json = await http.GetStringAsync("https://localhost:44349/api/Default"); 
            return JsonConvert.DeserializeObject<List<ExpandoObject>>(json); 
        } 
              
Please get back to us if you have any other queries.  
 
Regards, 
Vignesh Natarajan.  


Brice FROMENTIN
Replied On January 17, 2020 04:26 PM UTC

Hello,

Sorry with your explanation, it don't work.

If I use your method, I have the right number of lines but they are empty, I also try a custom Adaptor so it looks better integration but nothings work at all.

Do you have a sample with a custom adaptor and ExpandoObject that works on the grid ?

Renjith Singh Rajendran [Syncfusion]
Replied On January 21, 2020 12:47 PM UTC

Hi Brice, 

Thanks for contacting Syncfusion support. 

Based on the previously suggested solution, we have prepared a sample to bind ExpandoObject to Grid. Please download the sample from the link below, 
 
If you are still facing difficulties, kindly share with us the sample which you have tried from your side, for further analysis. 

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 


Brice FROMENTIN
Replied On January 25, 2020 04:59 PM UTC

Thanks it now works.

Renjith Singh Rajendran [Syncfusion]
Replied On January 27, 2020 05:15 AM UTC

Hi Brice, 

Thanks for your update. 

We are happy to hear that your problem has been resolved. 

Please get bac to us if you need further assistance. 

Regards, 
Renjith R. 


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