Multiple data loads in DataGrid when using custom adaptor and foreign keys

Hi,

The application:

Please find the attached razor page that I am currently using as the most basic sample.

 

I have constructed a DataGrid which load its data using SfDataManager.

The table is called TRA_ATTENDUS.

 

The adaptor is a custom one and its instance is a class called SfDataAdaptorServices<TRA_ATTENDUS>.

The signature of the class: "public class SfDataAdaptorServices<TEntity> : DataAdaptor, IDisposable where TEntity : class, new()"

We implemented as well the CRUD exposed from the SfClass such "public override async Task<object> ReadAsync(DataManagerRequest dm, string key = null)" and so on... the ASYNC way

So, this class implement DataAdaptor class. It is injected as Scoped in Startup.cs: "services.AddScoped<SfDataAdaptorServices<TRA_ATTENDUS>>();"

 

For this sample, a unique foreign column is displayed into the grid. This column values are loaded into a List on OnInitializedAsync using the same service as the SfDataManager.

 

The issue:

When the razor page is loading, I can see that ReadAsync method (from SfDataAdaptorServices class) is called four times.

Resulting in the data of the grid being pulled four times from our database, using SQL Server Management/SQL profiler

I observe one call related to the FK (TRAPL_APPLICATIONS) and three related to the datagrid content (TRA_ATTENDUS). I was expecting only one call to the datagrid content.

 

Test case #1: (no issue)

If I don’t put any foreign columns in the grid (and only put “simple” columns), the read async method of SfDataAdaptorServices class is called once as expected.

 

Test case #2:

I put one or more foreign columns (because the TRA_ATTENDUS has up to 7 FK), the read async method of SfDataAdaptorServices is repeated more than expected.

Taking 5 foreign columns, I observe 12 calls to the read method: 5 equals to the 5 FK and 7 because the main datagrid request is repeated.

 

I can’t find why the data adaptor is called so many times instead of once, and if it is a normal way to use CustomDataAdaptor.

What are the events that could explain several calls to the data adaptor?

Can I force the data adaptor to read the data only once when the page is loaded?

Thanks for your help.

Best regards.

François


Attachment: MultipleDataLoads_7cdf087c.zip

5 Replies

JP Jeevakanth Palaniappan Syncfusion Team March 5, 2021 01:48 PM UTC

Hi Francois, 

Greetings from Syncfusion support. 

We have validated your query by preparing a sample with foreignkey column and custom adaptor but unfortunately we are unable to reproduce the reported problem from our end. 

If we set 5 foreignkey columns then the Read method gets triggered 6 times(5 for foreignkey columns and 1 for grid data). We have attached the validated sample for your reference. 


If you are still facing the reported problem then kindly share us the below details, 

  1. Share us the Syncfusion NuGet version details.
  2. Are you using Server side application or WASM application.
  3. Share us the complete grid rendering code with your model class and datasource.
  4. Are you binding ForeignKey with local data or remote data.
  5. Kindly share us the issue reproducing sample or reproduce the issue in the provide sample.

The above requested details will be helpful for us to validate the issue and provide you with a better solution as early as possible. 

Regards, 
Jeevakanth SP. 



FR Francois April 1, 2021 04:19 PM UTC

Hi Jeevakanth,

To answer your questions:

-        The Nuget is Syncfusion.Blazor 19.1.0.54 (and formers like 18.4).

-        It is a server side application.

-        I am building ForeignKey with remote data (but in attached sample it is local data).

 

I joined a sample that reproduce my issue.

My DataGrid component is DatagridComponent.razor. It is displayed on the index page. The custom adaptor is CustomAdaptor.cs.

 

In this example the grid displays “order” with two foreign keys “Employee” and “Employee2”.

If I put a breakpoint in ReadAsync, I observe that ReadAsync is called three times.

 

If I put only one foreign key “Employee”, ReadAsync is called two times.

If I put no foreign key, ReadAsync is called once.

 

Can you explain why ReadAsync is called more times when there are foreign keys? I was expecting ReadAsync to be called once independently of the number of foreign keys.

 

Thanks for your help.

Best regards.

François



Attachment: SfDatagridWithFK_581c9028.zip


JP Jeevakanth Palaniappan Syncfusion Team April 5, 2021 07:09 AM UTC

Hi Francois, 
 
We have validated the problem and considered your reported problem as a bug and logged the defect report “Multiple API requests are sent to controller if foreign key column is defined in Grid”. Thank you for taking the time to report this issue 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 upcoming patch release which is expected to be rolled out on or before end of April, 2021.  
 
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,  
Jeevakanth SP. 



JB Joris Beentjes July 1, 2021 07:27 AM UTC

Hi,

What is the status of this since i am unable to open the provided issue link?


Kind regards,

Joris



JP Jeevakanth Palaniappan Syncfusion Team July 2, 2021 06:10 AM UTC

Hi Joris,  

Thanks for contacting Syncfusion support.  

We have enabled access to the feedback. Kindly try to view the feedback now.  


Sorry for the inconvenience caused. Due to unforeseen circumstances, we are unable to include the fix for the reported issue in our latest release as promised. It will be fixed and included our patch release which is expected to be rolled out by mid of July 2021.  

Till then we appreciate your patience.  

Regards, 
Jeevakanth SP. 


Loader.
Up arrow icon