Can't populate the grid with data through the WebApiAdapter

I am trying to get the grid to populate with data (currently only 1 record) using the WebApiAdapter.    There is no indication of an issue except for the fact that it does not hit the WebApi Method at all and does not pull any data.

           <SfGrid TValue="Data.Entities.Core.Program" AllowPaging="true">

                <SfDataManager Url="https://lifewirecore.local:44388/api/programs" Adaptor="Adaptors.WebApiAdaptor"></SfDataManager>

                <GridPageSettings PageSize="5"></GridPageSettings>

                <GridColumns>

                    <GridColumn Field=@nameof(Data.Entities.Core.Program.ProgramName) HeaderText="Program Name" TextAlign="TextAlign.Left" Width="120"></GridColumn>

                </GridColumns>

            </SfGrid>


The method to the API when ran through the browser returns this:

{"items":[{"programAdminList":"","programId":2,"portalId":1,"programName":"Test Program","programNameAbbr":"TST","isActive":true,"created":"2020-04-23T00:00:00","modified":null,"timeZone":"CST","showSMSResponseText":true,"sendInvalidResponse":true,"importProcessor":null,"notifyOutstandingChats":true,"defaultCarrierId":2,"settings":null,"importMapping":null,"sortOrder":null,"parentId":null,"isFolder":false,"deletedBy":null,"deletedDate":null,"createdBy":1,"modifiedBy":null,"programConfirmationFiles":[],"programImportFiles":[],"programProcesses":[],"programTags":[],"programAdmins":[],"programTemplates":[],"programUploadStatuses":[]}],"count":1}

However that method never gets hit when run through the application. The grid shows up properly, and looks like it's trying to do something, but never actually hits the method. There is also no error generated on either the browser or the client side, so I have no indication on what might actually be wrong.

If you can provide me with some additional information on things to look at, I would be appreciative.

Thanks!

Chico


3 Replies

AS ashimaz May 6, 2020 08:44 PM UTC

Try using OnActionFailure, it should show the exact error.


<GridEvents TValue="Data.Entities.Core.Program" OnActionFailure="@GridLoadFailure"/>

public async void GridLoadFailure(Syncfusion.Blazor.Grids.FailureEventArgs args)
{
await JsRuntime.InvokeAsync<string>("console.log", args.Error);
}


CM Chico Marvici May 6, 2020 10:19 PM UTC

Thank you.  That does help.   I was able to figure out what the cause of the issue is..   And I was previously unaware with how to deal with errors that would happen in the grid.  Thanks!


RS Renjith Singh Rajendran Syncfusion Team May 7, 2020 05:38 AM UTC

Hi Chico, 

Greetings from Syncfusion support. 

We could see that, the suggestion of OnActionFailure provided by ashimaz helped you in resolving the problem you are facing.  

And if you are still facing difficulties, then kindly get back to us with the error details you get in args of OnActionFailure event for further analysis. 
Documentation :  
 
Regards, 
Renjith Singh Rajendran 


Loader.
Up arrow icon