Unable to trigger API request only when GridDetailView row is expanded #1178
Unanswered
rafinhavvz
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi team,
I’m trying to use with DetailTemplate to display child data for each row. My goal is to load the details only when the row is expanded, in order to avoid making multiple unnecessary API requests.
Here’s what I have so far:
Problem:
The Data parameter expects an IEnumerable synchronously.
My data is fetched asynchronously from an API (HttpClient).
If I try to call an async method in the template (like @await LoadDetailsAsync(context.NumeroProcesso)), it either fires all requests at once for every row, or is not allowed because the template must be synchronous.
Using .GetAwaiter().GetResult() or .Result throws a PlatformNotSupportedException in Blazor WebAssembly.
What I want:
To have a way to trigger the API call only when the user expands the row, without fetching data for all rows in advance.
Preferably using a native GridDetailView event, so that the call is lazy-loaded per row.
Question:
Is there a recommended way in BlazorBootstrap to achieve lazy-loading of detail rows in ? If not, can an OnRowExpand or equivalent event be added to handle this scenario?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions