Search ahead not updating template

22 Views Asked by At

I have a fairly simple component, the initial page loads works fine but when I search for text it is not filtering or changing the DOM

I have been following this guide

could anyone help? It feels like I am missing a step or something is not marking the template as needing to be re-render

@page "/software"
@using SoftwareAudit.Services
@attribute [StreamRendering]

<PageTitle>Software</PageTitle>

<h1>Edr</h1>

@if (avDevices == null)
{
    <div class="spinner-border m-5" role="status">
        <span class="visually-hidden">Loading...</span>
    </div>
}
else
{
    <div class="text-center bg-blue-100">
        <input class="border-4 w-1/3 rounded m-6 p-6 h-8
               border-blue-300" @bind-value="SearchText"
               @bind-value:event="oninput" placeholder="Search by name" />
    </div>

    <div class="d-flex">
        <div class="table-responsive p-2">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>EDR Name</th>
                        <th>EDR Number</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var dev in FilteredZone.OrderBy(d => d.name))
                    {
                        <tr>
                            <td>@dev.name</td>
                            <td>@dev.count</td>
                        </tr>
                    }

                </tbody>
            </table>
        </div>
    </div>
}

@code {
    public string SearchText = "";
    private List<ProcessedZone> avDevices;

    [Inject]
    private Services.EDRService EDRService { get; set; }
    [Inject]
    private HttpClient http { get; set; }

    protected override async Task OnInitializedAsync()
    {
        await EDRService.CreateEDRService(http);
        avDevices = await EDRService.ProcessZones();
    }

    List<ProcessedZone> FilteredZone => avDevices.Where(
            device => device.name.ToLower().Contains(SearchText.ToLower())).ToList();
   
}
1

There are 1 best solutions below

0
Kevin On BEST ANSWER

So this may be my being new to Blazor but the issue was simply adding this to the top of the page

@rendermode InteractiveServer