Coder Social home page Coder Social logo

Table Select about ant-design-blazor HOT 3 OPEN

reinerosqvist avatar reinerosqvist commented on May 26, 2024
Table Select

from ant-design-blazor.

Comments (3)

ElderJames avatar ElderJames commented on May 26, 2024

Thanks for contacting us @reinerosqvist , you need to implement the search process by your self.

from ant-design-blazor.

ElderJames avatar ElderJames commented on May 26, 2024
@using AntDesign.Docs.Services
<Select Style="width: 200px;"
        ValueProperty="c=>c"
        LabelProperty="c=>c.Name"
        DataSource="data"
        @bind-Values="@selectedRows"
        Mode="multiple"
        DropdownMatchSelectWidth="false"
        EnableSearch
        OnSearch="OnSearch">
    <DropdownRender>
        <Table @ref="table" DataSource="@data" @bind-SelectedRows="selectedRows" RowKey="x=>x.Name">
            <ColumnDefinitions Context="ctx">
                <Selection Key="@ctx.Name" />
                <PropertyColumn Property="c=>c.Name">
                    <a>@ctx.Name</a>
                </PropertyColumn>
                <PropertyColumn Property="c=>c.Age"/>
                 <PropertyColumn Property="c=>c.Address"/>
            </ColumnDefinitions>
        </Table>
    </DropdownRender>
</Select>

@code
{
    ITable table;
    IEnumerable<Column> selectedRows=[];
    Column[] data;

    protected override void OnInitialized()
    {
        data = dataSource;
        base.OnInitialized();
    }

    void OnSearch(string searchValue)
    {
        data = dataSource.Where(x => x.Name.Contains(searchValue, StringComparison.InvariantCultureIgnoreCase)).ToArray();
    }

    class Column
    {
        public string Name { get; set; }

        public int Age { get; set; }

        public string Address { get; set; }
    }
    
    Column[] dataSource =
    {
        new Column()
        {
            Name = "John Brown",
            Age = 32,
            Address = "New York No. 1 Lake Park",
        },
        new Column()
        {
            Name = "Jim Green",
            Age = 42,
            Address = "London No. 1 Lake Park",
        },
        new Column()
        {
            Name = "Joe Black",
            Age = 32,
            Address = "Sidney No. 1 Lake Park",
        },
        new Column()
        {
            Name = "Disabled User",
            Age = 99,
            Address = "Sidney No. 1 Lake Park",
        }
    };
}

from ant-design-blazor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.