Closed guardrex closed 4 months ago
Nevermind! The rubber 🦆 resolved this. Working code turned out to be ...
@code {
private IQueryable<Movie>? movies;
[SupplyParameterFromQuery]
public string? TitleSearch { get; set; }
protected override void OnParametersSet()
{
if (!string.IsNullOrEmpty(TitleSearch))
{
movies = DB.Movie.Where(s => !string.IsNullOrEmpty(s.Title) ? s.Title.Contains(TitleSearch) : false);
}
else
{
movies = DB.Movie;
}
}
}
... and we'll modify further on review of the PR later.
Is there an existing issue for this?
Describe the bug
I don't think that this is the same as Add support to the QuickGrid paginator for static server rendering (
dotnet/aspnetcore
#51249), but it might have the same cause.When scaffolding into a BWA that only adopts static SSR, the following code works ✔️ ...
... and the following works, too ✔️ (ignore NRT static analysis, as this is for only for discussion here, and assume a QS is provided e.g.,
?movieSearch=XXX
) ...... but the following no-ops ❌. The QG doesn't display data, but the collection (
movies
) does receive the correctDbSet
from the dB inOnParametersSet
. Why? ... and what's the correct approach that I can use with the new Blazor tutorial (static SSR) for this search/filter scenario?This ...
... is a working approach ✔️ ... or to deal with the nullable
Title
...... but the ❓ stands on the no-op code below.
I'll place the full component code here for inspection ...
It doesn't work with
movies
as anIQueryable
either ❌ ...Expected Behavior
The
movies
collection is valid for theItems
param, and the movies are rendered by the QG.Steps To Reproduce
:point_up: Shown above.
Exceptions (if any)
None ... the QG merely displays no items.
.NET Version
8.0
Anything else?
No response