Welcome to the Blazor feedback portal. We’re happy you’re here! If you have feedback on how to improve the Blazor, we’d love to hear it!

  • Check out the features or bugs others have reported and vote on your favorites. Feedback will be prioritized based on popularity.
  • If you have feedback that’s not listed yet, submit your own.

Thanks for joining our community and helping improve Syncfusion products!

1
Vote

Hi all, I've created an SfGrid with SfDataManager of type CustomAdaptor to read paged data async from a ViewModel. Unfortunately passing data by means of Query.AddParam("myParam", "myData") doesn't work or fetching a service via DI (either via [Inject] nor by ScopedService.GetService() within CustomAdaptor.ReadAsync(...) doesn't work. Member variable ScopedService can not be accessed since it isn't initalized at this point, and Injected Services aren't available at this point when ReadAsync is called.

How can I pass parameters to the CustomAdaptor in ReadAsync() method? Source code is attached in zip file.

here is the relevant code snippet:

    public class CustomAdaptor : DataAdaptor

    {

        [Inject] public static HttpClient httpclient { get; set; } 

        

[Inject] 
public OrderService OrderData { get; set; }


        // Performs data Read operation

        public override async Task ReadAsync(DataManagerRequest dataManagerRequest, string key = null)

        {

            if (ScopedServices != null)

            {

                OrderData = ScopedServices.GetService(typeof(OrderService)) as OrderService;

                var data = await OrderData.GetPeople();

                return new DataResult { Result = data, Count = dataManagerRequest.Take };

            }

            return new DataResult();

        }

    }