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

EjsDataManager does not display records

Thread ID:

Created:

Updated:

Platform:

Replies:

147515 Sep 13,2019 01:37 PM UTC Oct 11,2019 07:25 AM UTC Blazor 8
loading
Tags: Grid
Mr Andrey Voronov
Asked On September 13, 2019 01:37 PM UTC

I set up [ApiController] [Route("api")] and tested that it works by typing http://..../api in browser.

I also set breakpoint on return new { Items = ..., Count = ...} statement

          <EjsGrid>
<EjsDataManager Url="api" Adaptor="Adaptors.WebApiAdaptor"></EjsDataManager>

hits breakpoint, but nevertheless no records are displayed in the grid.


I noticed that there is Adaptors.BlazorAdaptor but not found any documentation of using it. Ideally it would be better to have an ability to call await GetData(skip, take) method on blazor control directly instead of  creating api.



Vignesh Natarajan [Syncfusion]
Replied On September 16, 2019 07:16 AM UTC

Hi Andrey,  

Greetings from Syncfusion support.  

Query1: “hits breakpoint, but nevertheless no records are displayed in the grid. 
 
We suspect that you are facing Camel Case issue in Asp.Net Core. Normally, ASP.NET Core 1.0+ framework has camel casing issues while serializing the JSON Object. If you are facing the same camel casing issue while running the sample then please use the below codes in Startup.cs file to overcome that casing issue in Application level.  
 
In the below code, we have called the ContractResolver options under the Startup.cs file to avoid camel casing conversion during the serialization process. The is related to ASP.NET Core specifics and we suggest refer to the following article which describes how to overcome a similar issues. 
 
 
Please use the code below, 

[Startup.cs] 
 
        public void ConfigureServices(IServiceCollection services) 
        { 
 
            services.AddMvc().AddNewtonsoftJson(options => { 
                options.SerializerSettings.ContractResolver = new DefaultContractResolver(); 
            }); 
       } 

 
Note: WebAPI controller must return the values in form of Items and Count (refer below screenshot). Kindly ensure this in your sample.  

 

For your convenience we have prepared a sample which can be downloaded from below  

Refer our UG documentation for your reference 


Query2: “I noticed that there is Adaptors.BlazorAdaptor but not found any documentation of using it 
 
By default, Grid will consider the Adaptor Type as BlazorAdpator if we bind the dataSource in form of List of objects or IEnumerable. So it is not necessary to define Blazor adaptor separately in EjsDataManager. Refer our UG documentation for your reference. 
 

Please get back to us if you have further queries.   

Query3: “Ideally it would be better to have an ability to call await GetData(skip, take) method on blazor control directly instead of  creating api 

You can use GetJsonAsync() method of http to retrieve the entire data from WebAPI controller to bind it to Grid in the form of list of objects. But this requirement can be achieve while using Client Side Blazor or Hosted Blazor Application. So kindly confirm your Blazor Application type. Based on your confirmation, we will provide the solution / possible way to retrieve data from API controller      

Regards, 
Vignesh Natarajan.  


Mr Andrey Voronov
Replied On September 16, 2019 10:47 AM UTC

 Adding  services.AddMvc().AddNewtonsoftJson  fixed records displaying issue. But templated colums are not displaying (System.ArgumentException: Property set method not found) when I am using WebApiAdaptor



Vignesh Natarajan [Syncfusion]
Replied On September 17, 2019 11:58 AM UTC

Hi Manuel, 
  
Thanks for the update.  
  
Query: “But templated columns are not displaying (System.ArgumentException: Property set method not found) when I am using WebApiAdaptor” 
  
The reported issue is occurred when using the Model class with read-only properties (i.e) without set property in class definition. While using WebAPI Adaptor data will be returned in the form of string from the server. So they will be deserialized based on the model class provided in ModelType and assign it to context. Since you have defined some properties as read-only (i.e) without set property the reported issue is occurred. You can resolve the reported issue in either way.  
  
  1. Define the read-only properties by using readonly attribute instead of ignoring the set property. Refer the below code example
  
public class Orders 
    { 
        public long OrderID { get; set; } 
        public readonly string CustomerID = "Vinet"; 
        public int EmployeeID { get; set; } 
        .       .         .           .  
    } 
     
  1. Or you can also create another model Class with similar properties (ie. with getter and setter properties) and define that class as ModelType value. Refer the below code example
  
<EjsGrid TValue="OrdersDetails" ModelType="@Model" AllowPaging="true"> 
    <EjsDataManager Url="api/Default" Adaptor="Adaptors.WebApiAdaptor"></EjsDataManager> 
…………………………………. 
</EjsGrid> 
  
@code{ 
    public List<OrdersDetails> Order = new List<OrdersDetails>(); 
    public OrdersDetails Model = new OrdersDetails(); 
    public class ViewModel 
    { 
        public long OrderID { get; set; } 
        public string CustomerID { get; set; } 
        .            .           .          .           .           .  
    } 
} 
  
  
Please get back to us if you have further queries.   
   
Regards, 
Vignesh Natarajan. 


Mr Andrey Voronov
Replied On September 18, 2019 02:55 PM UTC

My POCO model has no read-only fields, but has TimeSpan { get; set;} property. 

WebApiAdaptor does not displays templated fields if POCO model has TimeSpan properties..




Vignesh Natarajan [Syncfusion]
Replied On September 19, 2019 09:06 AM UTC

Hi Andrey,  

Query: “WebApiAdaptor does not displays templated fields if POCO model has TimeSpan properties.. 

We are able to reproduce the reported issue at our end too while preparing a sample as per your suggestion. We have considered the reported issue as a bug and logged defect report “Template column is not rendered properly while using Model class with TimeSpan property and WebAPI adaptor” for the same. Fix for the issue will be included in our upcoming Nuget release which is expected to be roll out in the first week of October 2019. 

You can track the status of the issue and contact us through the below feedback portal 


Till then we appreciate your patience. 

Regards,
Vignesh Natarajan.


Mr Andrey Voronov
Replied On October 4, 2019 12:17 PM UTC


EjsDataAdapter' TimeSpan  issue still not has been fixed in the latest 17.3.11 release.

I am getting:

Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing number: :. Path '', line 1, position 2.
   at Newtonsoft.Json.JsonTextReader.ReadNumberCharIntoBuffer(Char currentChar, Int32 charPos)
   at Newtonsoft.Json.JsonTextReader.ReadNumberIntoBuffer()
   at Newtonsoft.Json.JsonTextReader.ParseNumber(ReadType readType)
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonReader.ReadAndMoveToContent()
   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type)
   at Syncfusion.EJ2.Blazor.BaseComponent.ChangeType(Object value, Type conversionType)
   at Syncfusion.EJ2.Blazor.BaseComponent.GetObject(Dictionary`2 Data, Type ModelType)
   at Syncfusion.EJ2.Blazor.Grids.GridColumn.BuildRenderTree(RenderTreeBuilder __builder)
   at Microsoft.AspNetCore.Components.ComponentBase.<.ctor>b__6_0(RenderTreeBuilder builder)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()

Vignesh Natarajan [Syncfusion]
Replied On October 7, 2019 10:28 AM UTC

Hi Andrey,  

We regret for the inconvenience caused.  

Due to some unforeseen circumstances, we will not be able to include the fix for this bug Template column is not rendered properly while using Model class with TimeSpan property and WebAPI adaptor in our latest Nuget release. But we will fix this bug and this will be included in our subsequent Bi-Weekly Nuget release which is expected to be rolled out on or before 16th October 2019.  

Until then we appreciate your patience. 

Regards, 
Vignesh Natarajan.

Vignesh Natarajan [Syncfusion]
Replied On October 11, 2019 07:25 AM UTC

Hi Andrey,  
 
We are glad to inform that our latest Nuget package (17.3.0.17-beta) has been successfully rolled out. In this release we have included the fix for the issue “Template column is not rendered properly while using Model class with TimeSpan property and WebAPI adaptor”. Please find the latest Nuget package and release notes regarding the changes in Grid from below   
 
 
 
Also ensure that you have referred the latest version script and css as below  
 
<link rel='nofollow' href="https://cdn.syncfusion.com/ej2/17.3.17/fabric.css" rel="stylesheet" /> 
    <script src="https://cdn.syncfusion.com/ej2/17.3.17/dist/ej2.min.js"></script>  
    <script src="https://cdn.syncfusion.com/ej2/17.3.17/dist/ejs.interop.min.js"></script> 
 
 
Please 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