🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

FilterDropDownList.Blazor

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

FilterDropDownList.Blazor

A filterable dropdown list component for blazor applications

1.2.0
Source
NuGet
Version published
Maintainers
1
Created
Source

FilterDropDownList.Blazor

A filterable dropdown list component for Blazor applications.

Features

  • Filter on multiple properties
  • Uses the Virtualize component for rendering performance
  • Renders when a paramater of the component is updated or when interacting with the component (for performance)

Usage/Examples

Install form NuGet

Add Imports in _Imports.razor file

To avoid having to add using statements for FilterDropDownList.Blazor to lots of components in your project, it's recommended that you add the following to your root _Imports.razor file. This will make the following usings available to all component in that project.

@using FilterDropDownList.Blazor.GenericFilterSelect
@using FilterDropDownList.Blazor.GenericFilterSelect.Models;

Basic Usage

<h3>Component</h3>

<FilterSelectComponent @bind-BindValue="SelectedPerson"
                       TData="PersonModel"
                       Data="PersonList"
                       FilterAgainstPropertyName="@($"{nameof(PersonModel.Name)}")"
                       OnSelectListItem="OnPersonSelected"
                       Label="Persons">
    <RowTemplate>
        @context.ID - @context.Name
    </RowTemplate>
</FilterSelectComponent>

@code {

    public class PersonModel
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public string Surname { get; set; }
    }

    private List<PersonModel> PersonList { get; set; } = new();
    public PersonModel SelectedPerson { get; set; } = new();

    protected override void OnInitialized()
    {
        PersonList.Add(new PersonModel { ID = 1, Name = "Huciko", Surname = "Zellikan" });
        PersonList.Add(new PersonModel { ID = 2, Name = "John", Surname = "Gray" });
        PersonList.Add(new PersonModel { ID = 3, Name = "Jack", Surname = "Black" });
    }

    // Optional method to execute on item selected
    private void OnPersonSelected(FilterSelectComponentEventCallbackArgs<PersonModel> args)
    {
        // FilterSelectComponentEventCallbackArgs model has two properties
        // SelectedItem, a reference to the selected iten in the dropdown
        // ExtraParameter, an extra optional parameter (object) to pass together the SelectedItem
        string personName = args.SelectedItem.Name;
    }
}

Keywords

Blazor

FAQs

Package last updated on 13 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts