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. Image for the cookie policy date
close icon

EjsDataManager

Bug: Grid's spinner is spinning indefinitely if EjsDataManager returns no records.

Question: EjsDataManager has no StateHasChanged() method. How can I refresh grid's data when using EjsDataManager WebApi adapter ?

11 Replies

RS Renjith Singh Rajendran Syncfusion Team October 3, 2019 09:56 AM UTC

Hi Mr Andrey, 

Thanks for contacting Syncfusion support. 

Query 1 : Grid's spinner is spinning indefinitely if EjsDataManager returns no records. 
We have tried to reproduce the reported problem by creating a sample in our latest version 17.3.0.10-beta to bind an empty data for the Grid. But we are not able to reproduce the problem. Grid renders fine by showing “No Records to display” and no spinner is shown in Grid. We are attaching the sample which we have tried form our side. Please download the sample form the link below, 
 
If you are still facing difficulties, we need more details to further proceed on this. Kindly share with us the following details for better assistance. 
  1. Share the sample which you have tried from your side.
  2. Share the Syncfusion Blazor version details.
  3. Share the details of the script error or exception if you have faced any.
  4. Share with us the exact scenario or proper replication procedure.
  5. Share the video demo showing the problem you are facing.

Query 2 : How can I refresh grid's data when using EjsDataManager WebApi adapter ? 
We suggest you to call the “Refresh()” method of Grid. Calling the “Refresh” method will send a post to the server. And so, will fetch the data from server and bind the newly fetched data to Grid. Please refer the code below, for an example purpose we have called the Refresh method inside a button click handler. 

... 
 
<EjsButton OnClick="RefreshGrid">Grid Refresh</EjsButton> 
 
<EjsGrid @ref="GridInstance" TValue="Order" AllowPaging="true" Height="300" ...> 
    <EjsDataManager @ref="DataInstance" Url="api/Default" Adaptor="Adaptors.WebApiAdaptor"></EjsDataManager> 
    ... 
</EjsGrid> 
 
 
@code{ 
    EjsGrid<Order> GridInstance; 
    ... 
   public void RefreshGrid(MouseEventArgs args) 
    { 
        GridInstance.Refresh(); 
    } 
} 


Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 



MA Mr Andrey Voronov October 3, 2019 11:31 AM UTC

My WebApi adapter returns records from SQL database which initially contains no records; If I add records to the database manually, refresh button does not pick up new records.

Refresh does work if at least one record displayed in the grid initially and new records added to the database manually later on



MA Mr Andrey Voronov October 4, 2019 07:27 AM UTC

I have been able to reproduce "keeps spinning" bug:


You need to add OnDataBound event to the sample code provided:

<EjsGrid @ref="GridInstance" TValue="Order" AllowPaging="true" Height="100%">

<EjsDataManager @ref="DataInstance" Url="api/Default" Adaptor="Adaptors.WebApiAdaptor"></EjsDataManager>

<GridSelectionSettings Mode="Syncfusion.EJ2.Blazor.Grids.SelectionMode.Row" Type="SelectionType.Single"></GridSelectionSettings>

<GridEvents TValue="Order" OnDataBound="@DataBound"></GridEvents>

<GridColumns>
<GridColumn Field="OrderID" HeaderText="Order ID" IsPrimaryKey="true" IsIdentity="true" Width="90"></GridColumn>
<GridColumn Field="EmployeeID" HeaderText="Employee ID" Width="90"></GridColumn>
<GridColumn Field="Freight" HeaderText="Freight" EditType="EditType.NumericEdit" Width="90"></GridColumn>
<GridColumn Field="OrderDate" HeaderText="Order Date" Type="ColumnType.Date" Format="yMd" EditType="EditType.DateTimePickerEdit" Width="90"></GridColumn>
<GridColumn Field="ShipCountry" HeaderText="Ship Country" Width="90"></GridColumn>
</GridColumns>

</EjsGrid>


protected async Task DataBound(BeforeDataBoundArgs<Order> args)
{
await Task.CompletedTask;
}


VN Vignesh Natarajan Syncfusion Team October 7, 2019 04:01 AM UTC

Hi Andrey, 
 
Query1: “My WebApi adapter returns records from SQL database which initially contains no records 
 
We understand that you are facing issue when inserting the record with empty dataSource in Grid. Since we are unclear about the cause of the issue, we need some additional details regarding the query. So kindly share the following details. 
 
  1. Are you facing the reported issue while using Grid Built-in Crud operation (i.e) WebAPI Adaptor’s  (PUT, POST).
  2. Because while using Built-in CRUD operation, it is not necessary to call Refresh method manually to bring the changes from WebAPI.
  3. So share the details how you have bound the dataSource to Grid from WebAPI service.
  4. Also share the screenshot of Network tab, response window how the datas were returned from server.  
  5. Share the Grid rendering code example.
 
Regards, 
Vignesh Natarajan. 



MA Mr Andrey Voronov October 7, 2019 07:53 AM UTC

I do not use grid built in CRUD operators. There is a web service which inserts records into a SQL table and I call grid's refresh method every 30 secs to display those records using WebApi adapter..

Everything works fine if grid displays at least one record initially, as new records will be popping up in the grid.

But If I truncate SQL table, start the program, and web service after (which will be inserting new records into the table),  just "No records" will be displayed all the time in the grid.

 


RS Renjith Singh Rajendran Syncfusion Team October 8, 2019 04:35 PM UTC

Hi Mr Andrey, 

Thanks for contacting Syncfusion support. 

We have prepared a sample based on this scenario, initially Grid will be empty and after calling Refresh() each time a new row will be added in Grid(without using inbuilt CRUD). We could not reproduce the issue, new rows gets added each time we call the refresh. We are attaching the sample for your convenience. Please download the sample from the link below, 
 
We have also prepared a video demo showing the details in the network tab for each web api service requests. In the below video, each time the “Refresh()” method is called, a Request will be send to fetch the data from the web api service. So initially Grid will be empty and each time the Refresh button is clicked, Grid will be refreshed with a new row. 

If you are still facing difficulties, kindly share with us the following details for better assistance. 
  1. Share the sample which you have tried from your side or provide a simple test sample to reproduce the issue.
  2. Share the full Grid code.
  3. Share the video/screenshot showing the network tab response for each actions.
  4. Or else, if possible kindly reproduce the reported problem with the attached sample and share with us.

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 



MA Mr Andrey Voronov October 13, 2019 05:22 PM UTC

Here are the steps to reproduce a similar "grid not refreshing" bug:

a) Change  DefaultController to display one record initially

b) Add Delete button

c) Add OnDataBound (IMPORTANT)

Once grid is displayed, hit Delete button, and Refresh button. Notice that grid is still displaying that record no matter how many times you hit refresh button.

If you comment 
<GridEvents OnDataBound="DataBound" TValue="Order"></GridEvents>
everything works as expected

Please find not working project attached. 
Hope you will be able to fix this issue soon.



Attachment: TestGridApi_b74d0e41.zip


RS Renjith Singh Rajendran Syncfusion Team October 14, 2019 01:17 PM UTC

Hi Mr Andrey, 

We have analyzed the sample. Once the record is deleted, during Refresh() call empty data is returned to be bound to Grid. So this problem occurs, enabling “OnDataBound” event when binding empty record to Grid.  
 
We have confirmed this problem as a bug and logged a bug report for the same. Thank you for taking the time to report this issue Problem with using "OnDataBound" event when bind empty data for Grid and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle ) and including the defect fix in our subsequent Nuget release which is expected to be roll out on or before October 31, 2019.  

You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.  
 
Until then we appreciate your patience. 

Regards, 
Renjith Singh Rajendran. 



RS Renjith Singh Rajendran Syncfusion Team November 1, 2019 12:15 PM UTC

Hi Mr Andrey,   

We are glad to inform you that our latest Nuget package (17.3.0.21-beta) has been successfully rolled out. In this release, we have included the fix for the issue “Problem with using "OnDataBound" event when bind empty data for Grid”. Please find the latest Nuget package from the link below, 

 
 
Also ensure to refer the latest version script and css in your application.  
 
     
    <link rel='nofollow' href="https://cdn.syncfusion.com/ej2/17.3.21/fabric.css" rel="stylesheet" /> 
 
 
Please get back to us if you have further queries. 

Regards, 
Renjith Singh Rajendran. 




MA Mr Andrey Voronov November 4, 2019 03:27 PM UTC

After upgrading Syncfusion.EJ2.Blazor NuGet package to v17.3.0.21 I am getting compilation error:

Error CS1705 Assembly 'Syncfusion.EJ2.Blazor' with identity 'Syncfusion.EJ2.Blazor, Version=17.3.0.21, Culture=neutral, PublicKeyToken=null' uses 'Microsoft.AspNetCore.Components, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' which has a higher version than referenced assembly 'Microsoft.AspNetCore.Components' with identity 'Microsoft.AspNetCore.Components, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' TestGridApi i:\Projects\NetCore\TestGridApi\CSC 1 Active



VN Vignesh Natarajan Syncfusion Team November 5, 2019 05:25 AM UTC

Hi Andrey,  

Query: “After upgrading Syncfusion.EJ2.Blazor NuGet package to v17.3.0.21 I am getting compilation error 
 
From our 17.3.0.19-beta release, we have migrated our components to .Net Core 3.1 Preview 1. So kindly upgrade your project to latest version of .Net Core (3.1 Preview 1) to resolve the issue. Please get back to us if you have any queries.  

Regards, 
Vignesh Natarajan. 


Loader.
Live Chat Icon For mobile
Up arrow icon