CustomAdaptor Component using Blazor Wasm problem

Hi I have made a CustomAdaptor for my Blazor WebAssembly project, the problem is the ReadAsync event is never being fired.

I have followed the example page:example


I have attached a sample where ReadAsync method is never fired

The constructor of DataAdaptorComponent is fired initializing the class.

What am I missing?


Attachment: blazortest_a16a092f.7z


3 Replies

VN Vignesh Natarajan Syncfusion Team August 4, 2021 04:02 AM UTC

Hi Daniel,  
 
Thanks for contacting Syncfusion support.  
 
Query: “I have made a CustomAdaptor for my Blazor WebAssembly project, the problem is the ReadAsync event is never being fired. 
 
We have analyzed the reported issue with the provided sample and we are able to reproduce the reported issue at our end also. This is because you have defined an empty overridden OnInitializedAsync lifecycle method which causes the further action from proceeding. Hence the reported issue also occurred. Kindly modified the code as below to resolve the reported issue.  
 
Also return the data from ReadAsync in form of DataResult to bind the data properly in Grid. Refer the below modified code example.  
 
protected override Task OnInitializedAsync() 
{ 
    return base.OnInitializedAsync(); 
} 
  
public override async Task<objectReadAsync(DataManagerRequest dataManagerRequest, string key = null) 
{ 
    List<Usuario> lst = new List<Usuario>(); 
    lst.Add(new Usuario() { Id = 2 }); 
    Console.WriteLine("ReadAsync was Fired"); 
    return dataManagerRequest.RequiresCounts ? new DataResult() { Result = lst, Count = lst.Count } : (object)lst; 
} 
 
 
Please find the modified sample from below  
 
 
Please get back to us if you have further queries.  
 
Regards, 
Vignesh Natarajan  
 



DA Daniel replied to Vignesh Natarajan August 4, 2021 01:31 PM UTC

Thanks that worked flawless!! 

Just for adding info, the overriden metod  protected override Task OnInitializedAsync() 

cannot have a return, it doesn't compile

it should be only 

protected override Task OnInitializedAsync() 
{ 
    await base.OnInitializedAsync(); 
} 


VN Vignesh Natarajan Syncfusion Team August 5, 2021 03:29 AM UTC

Hi Daniel,  

Thanks for the information.  

We are glad to hear that you have resolved your query using our solution.  

Kindly get back to us if you have further queries.  

Regards, 
Vignesh Natarajan  


Loader.
Up arrow icon