logoEnterprise-level component library based on Bootstrap and Blazor
gitee
version
license
download
repo
commit
build
coverage

ListView

Provides rule arrangement controls

Apply to a large number of duplicate data implementation rule arrangements

Demo

The OnListViewItemClick event is triggered when you click on the image

The list of products
Pic1.jpg
Pic2.jpg
Pic3.jpg
Pic4.jpg
Pic5.jpg
Pic6.jpg
Pic7.jpg
Pic8.jpg
Pic9.jpg
Pic10.jpg
Pic11.jpg
Pic12.jpg
Pic13.jpg
Pic14.jpg
Pic15.jpg
Pic16.jpg
Pic17.jpg
Pic18.jpg
Pic19.jpg
Pic20.jpg
Pic21.jpg
Pic22.jpg
Pic23.jpg
Pic24.jpg
Pic25.jpg
Pic26.jpg
Pic27.jpg
Pic28.jpg
Pic29.jpg
Pic30.jpg
Pic31.jpg
Pic32.jpg
Pic33.jpg
Pic34.jpg
Pic35.jpg
Pic36.jpg
Pic37.jpg
Pic38.jpg
Pic39.jpg
Pic40.jpg
Pic41.jpg
Pic42.jpg
Pic43.jpg
Pic44.jpg
Pic45.jpg
Pic46.jpg
Pic47.jpg
Pic48.jpg
Pic49.jpg
Pic50.jpg
Pic51.jpg
Pic52.jpg
Pic53.jpg
Pic54.jpg
Pic55.jpg
Pic56.jpg
Pic57.jpg
Pic58.jpg
Pic59.jpg
Pic60.jpg
Pic61.jpg
Pic62.jpg
Pic63.jpg
Pic64.jpg
Pic65.jpg
Pic66.jpg
Pic67.jpg
Pic68.jpg
Pic69.jpg
Pic70.jpg
Pic71.jpg
Pic72.jpg
Pic73.jpg
Pic74.jpg
Pic75.jpg
Pic76.jpg
Pic77.jpg
Pic78.jpg
Pic79.jpg
Pic80.jpg
Pic81.jpg
Pic82.jpg
Pic83.jpg
Pic84.jpg
Pic85.jpg
Pic86.jpg
Pic87.jpg
Pic88.jpg
Pic89.jpg
Pic90.jpg
Pic91.jpg
Pic92.jpg
Pic93.jpg
Pic94.jpg
Pic95.jpg
Pic96.jpg
Pic97.jpg
Pic98.jpg
Pic99.jpg
Pic100.jpg

Set the Pageable display paginated components

Demo
The list of products

Set up grouping GroupName data

Demo
The list of products

Attributes

Loading...

Methods

Loading...
@page "/listviews"
@inject IOptionsMonitor<WebsiteOptions> WebsiteOption
@inject IStringLocalizer<ListViews> Localizer

<h3>ListView</h3>

<h4>Provides rule arrangement controls</h4>

<DemoBlock Title="Basic usage" Introduction="Apply to a large number of duplicate data implementation rule arrangements" Name="Normal">
    <p>The <code>OnListViewItemClick</code> event is triggered when you click on the image</p>
    <div class="listview-demo">
        <ListView TItem="Product" Items="@Products" OnListViewItemClick="OnListViewItemClick">
            <HeaderTemplate>
                <div>The list of products</div>
            </HeaderTemplate>
            <BodyTemplate>
                <Card>
                    <BodyTemplate>
                        <img src="@context.ImageUrl" />
                        <div class="listview-demo-desc">@context.Description</div>
                    </BodyTemplate>
                </Card>
            </BodyTemplate>
            <FooterTemplate>
                <div class="text-end">
                    Coptyright Bootstrap Blazor
                </div>
            </FooterTemplate>
        </ListView>
    </div>
    <BlockLogger @ref="Trace" class="mt-3" />
</DemoBlock>

<DemoBlock Title="Paginated display" Introduction="Set the <code>Pageable</code> display paginated components" Name="Pagination">
    <div class="listview-demo">
        <ListView TItem="Product" Pageable="true" PageItems="21" OnQueryAsync="@OnQueryAsync">
            <HeaderTemplate>
                <div>The list of products</div>
            </HeaderTemplate>
            <BodyTemplate>
                <Card>
                    <BodyTemplate>
                        <img src="@context.ImageUrl" />
                        <div class="listview-demo-desc">@context.Description</div>
                    </BodyTemplate>
                </Card>
            </BodyTemplate>
        </ListView>
    </div>
</DemoBlock>

<DemoBlock Title="Group display" Introduction="Set up grouping <code>GroupName</code> data" Name="Group">
    <div class="listview-demo">
        <ListView TItem="Product" GroupName="@(p => p.Category)" OnQueryAsync="@OnQueryAsync">
            <HeaderTemplate>
                <div>The list of products</div>
            </HeaderTemplate>
            <BodyTemplate>
                <Card>
                    <BodyTemplate>
                        <img src="@context.ImageUrl" />
                        <div class="listview-demo-desc">@context.Description</div>
                    </BodyTemplate>
                </Card>
            </BodyTemplate>
        </ListView>
    </div>
</DemoBlock>

<AttributeTable Items="GetAttributes()"></AttributeTable>

<MethodTable Items="GetMethods()"></MethodTable>
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Website: https://www.blazor.zone or https://argozhang.github.io/

namespace BootstrapBlazor.Shared.Samples;

/// <summary>
/// 
/// </summary>
public sealed partial class ListViews
{
    [NotNull]
    private BlockLogger? Trace { get; set; }

    [NotNull]
    private IEnumerable<Product>? Products { get; set; }

    /// <summary>
    /// 
    /// </summary>
    protected override void OnInitialized()
    {
        base.OnInitialized();

        Products = Enumerable.Range(1, 100).Select(i => new Product()
        {
            ImageUrl = $"{WebsiteOption.CurrentValue.ImageLibUrl}/images/Pic{i}.jpg",
            Description = $"Pic{i}.jpg",
            Category = $"Group{(i % 4) + 1}"
        });
    }

    private Task<QueryData<Product>> OnQueryAsync(QueryPageOptions options)
    {
        var items = Products.Skip((options.PageIndex - 1) * options.PageItems).Take(options.PageItems);
        return Task.FromResult(new QueryData<Product>()
        {
            Items = items,
            TotalCount = Products.Count()
        });
    }

    private Task OnListViewItemClick(Product item)
    {
        Trace?.Log($"ListViewItem: {item.Description} clicked");
        return Task.CompletedTask;
    }

    private IEnumerable<AttributeItem> GetAttributes() => new AttributeItem[]
    {
        new AttributeItem(){
            Name = "Items",
            Description = Localizer["Items"],
            Type = "IEnumerable<TItem>",
            ValueList = " — ",
            DefaultValue = " — "
        },
        new AttributeItem(){
            Name = "Pageable",
            Description = Localizer["Pageable"],
            Type = "bool",
            ValueList = "true|false",
            DefaultValue = "false"
        },
        new AttributeItem(){
            Name = "HeaderTemplate",
            Description = Localizer["HeaderTemplate"],
            Type = "RenderFragment",
            ValueList = " — ",
            DefaultValue = " — "
        },
        new AttributeItem(){
            Name = "BodyTemplate",
            Description = Localizer["BodyTemplate"],
            Type = "RenderFragment<TItem>",
            ValueList = " — ",
            DefaultValue = " — "
        },
        new AttributeItem(){
            Name = "FooterTemplate",
            Description = Localizer["FooterTemplate"],
            Type = "RenderFragment",
            ValueList = " — ",
            DefaultValue = " — "
        },
        new AttributeItem() {
            Name = "OnQueryAsync",
            Description = Localizer["OnQueryAsync"],
            Type = "Func<QueryPageOptions, Task<QueryData<TItem>>>",
            ValueList = "—",
            DefaultValue = " — "
        },
        new AttributeItem() {
            Name = "OnListViewItemClick",
            Description = Localizer["OnListViewItemClick"],
            Type = "Func<TItem, Task>",
            ValueList = " — ",
            DefaultValue = " — "
        }
    };

    private IEnumerable<MethodItem> GetMethods() => new MethodItem[]
    {
        new MethodItem()
        {
            Name = "QueryAsync",
            Description = Localizer["QueryAsync"],
            Parameters = " — ",
            ReturnValue = "Task"
        }
    };
}

internal class Product
{
    public string ImageUrl { get; set; } = "";

    public string Description { get; set; } = "";

    public string Category { get; set; } = "";
}

B station related video link

No

交流群

QQ Group:BootstrapAdmin & Blazor 795206915 675147445 Welcome to join the group discussion
img
Themes
Bootstrap
Motronic
Ant Design (完善中)
DevUI (制作中)
LayUI (完善中)
An error has occurred. This application may no longer respond until reloaded. Reload
Seems like the connection with the server has been lost. It can be due to poor or broken network. Please hang on while we're trying to reconnect...
Oh snap! Failed to reconnect with the server. This is typically caused by a longer network outage, or if the server has been taken down. You can try to reconnect, but if that does not work, you need to reload the page.
Oh man! The server rejected the attempt to reconnect. The only option now is to reload the page, but be prepared that it won't work, since this is typically caused by a failure on the server.
Bootstrap Blazor Component library updated to 7.0.8-beta05

Bootstrap Blazor at present has more than 120 components. This component is based on Bootstrap Blazor An enterprise-level component library that provides several types of common components such as layout, navigation, form, data, notification, icon, voice, etc. Each component has been carefully designed with modularity, responsiveness and excellent performance. Starting from more practical scenarios, meeting the needs of various scenarios, greatly reducing the time cost of developers, greatly shortening the development cycle, greatly improving development efficiency, and providing a set of General Rights Management System Example project。Bootstrap Blazor Products are maintained by a professional full-time technical team, with efficient response speed, diversified solutions, long-term support, and enterprise-level support. At present, it has been used in many well-known state-owned enterprises, and the project is running stably with a maximum of 1200 people online. On the right is the QR code of the Chinese Blazor QQ community with the largest number of people in China, welcome to scan and join the group.

component updated to 6.6.0 Change log [portal] If the component brings you convenience, please help to light up the project Star github gitee

QQGroup
QQ 795206915