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

Pagination

When there is too much data, use paging to break down the data.

You can select the amount of data displayed per page by the drop-down box

Demo

Only one page does not display the switch page number component, only text prompts

Demo

By ShowPaginationInfo = 'false' setting does not display text prompts

Demo

Set Alignment contorl the pagination alginment

Demo

Set ShowGotoNavigator show/hide the Goto,can GotoTemplate custom the Goto navigator

Demo

Set ShowInfo show/hide the pager info

Demo

Set PageInfoTemplate curstom the template of page info

Demo

Attributes

Loading...
@page "/paginations"
@inject IStringLocalizer<Paginations> Localizer
@inject IStringLocalizer<Pagination> LocalizerPagination

<h3>Pagination</h3>

<h4>When there is too much data, use paging to break down the data.</h4>

<DemoBlock Title="Basic usage" Introduction="You can select the amount of data displayed per page by the drop-down box" Name="Normal">
    <Pagination PageCount="30" OnPageLinkClick="@OnPageClick"></Pagination>
    <BlockLogger @ref="Trace" class="mt-3" />
</DemoBlock>

<DemoBlock Title="Only text prompts are displayed" Introduction="Only one page does not display the switch page number component, only text prompts" Name="DispalyText">
    <Pagination PageCount="1"></Pagination>
</DemoBlock>

<DemoBlock Title="Only paginated components are displayed" Introduction="By <code>ShowPaginationInfo = 'false'</code> setting does not display text prompts" Name="MaxPageLinkCount">
    <Pagination PageCount="2000" MaxPageLinkCount="10"></Pagination>
</DemoBlock>

<DemoBlock Title="Alignment" Introduction="Set <code>Alignment</code> contorl the pagination alginment" Name="Alignment">
    <RadioList @bind-Value="Alignment" Items="AlignmentItems" />
    <Pagination PageCount="20" Alignment="@Alignment" class="mt-3"></Pagination>
</DemoBlock>

<DemoBlock Title="Goto navigator" Introduction="Set <code>ShowGotoNavigator</code> show/hide the Goto,can <code>GotoTemplate</code> custom the Goto navigator" Name="Goto">
    <Pagination PageCount="20" ShowGotoNavigator="true"></Pagination>
</DemoBlock>

<DemoBlock Title="Pager info" Introduction="Set <code>ShowInfo</code> show/hide the pager info" Name="PageInfoText">
    <Pagination PageCount="20" ShowPageInfo="true" PageInfoText="共 20 页" ShowGotoNavigator="true"></Pagination>
</DemoBlock>

<DemoBlock Title="Pager info template" Introduction="Set <code>PageInfoTemplate</code> curstom the template of page info" Name="InfoTemplate">
    <Pagination PageCount="@PageCount" ShowPageInfo="true" ShowGotoNavigator="true">
        <PageInfoTemplate>
            <div class="page-info me-2">@PageInfoText</div>
            <Select @bind-Value="PageItems" Items="PageItemsSource" style="width: 120px;" />
        </PageInfoTemplate>
    </Pagination>
</DemoBlock>

<AttributeTable Items="@GetAttributes()" />
// 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 Paginations
{
    private Alignment Alignment { get; set; } = Alignment.Right;

    [NotNull]
    private List<SelectedItem>? AlignmentItems { get; set; }

    [NotNull]
    private BlockLogger? Trace { get; set; }

    [NotNull]
    private List<SelectedItem>? PageItemsSource { get; set; }

    private int PageItems { get; set; } = 2;

    private int PageCount => 200 / PageItems;

    private string PageInfoText => $"每页 {PageItems} 条 共 {PageCount} 页";

    private Task OnPageClick(int pageIndex)
    {
        Trace.Log($"PageIndex: {pageIndex}");
        return Task.CompletedTask;
    }

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

        AlignmentItems ??= new List<SelectedItem>()
        {
            new("Left", "Start"),
            new("Center", "Center"),
            new("Right", "End")
        };

        PageItemsSource = new List<SelectedItem>()
        {
            new("2", "2条/页"),
            new("4", "4条/页"),
            new("10", "10条/页"),
            new("20", "20条/页")
        };
    }

    /// <summary>
    /// 获得属性方法
    /// </summary>
    /// <returns></returns>
    private IEnumerable<AttributeItem> GetAttributes() => new AttributeItem[]
    {
        new AttributeItem() {
            Name = "PageIndex",
            Description = Localizer["PageIndexAttr"],
            Type = "int",
            ValueList = " — ",
            DefaultValue = "1"
        },
        new AttributeItem() {
            Name = "PageCount",
            Description = Localizer["PageCountAttr"],
            Type = "int",
            ValueList = " — ",
            DefaultValue = " — "
        },
        new AttributeItem() {
            Name = "MaxPageLinkCount",
            Description = Localizer["MaxPageLinkCountAttr"],
            Type = "int",
            ValueList = " — ",
            DefaultValue = "5"
        },
        new AttributeItem() {
            Name = "OnPageLinkClick",
            Description = Localizer["OnPageLinkClickAttr"],
            Type = "Func<int, Task>",
            ValueList = " — ",
            DefaultValue = " — "
        },
        new AttributeItem() {
            Name = "Alignment",
            Description = Localizer["AlignmentAttr"],
            Type = "Alignment",
            ValueList = " — ",
            DefaultValue = "Alignment.Right"
        },
        new AttributeItem() {
            Name = "ShowPageInfo",
            Description = Localizer["ShowPageInfoAttr"],
            Type = "bool",
            ValueList = " — ",
            DefaultValue = "true"
        },
        new AttributeItem() {
            Name = "PageInfoText",
            Description = Localizer["PageInfoTextAttr"],
            Type = "string",
            ValueList = " — ",
            DefaultValue = " — "
        },
        new AttributeItem() {
            Name = "PageInfoTemplate",
            Description = Localizer["PageInfoTemplateAttr"],
            Type = "RenderFragment",
            ValueList = " — ",
            DefaultValue = " — "
        },
        new AttributeItem() {
            Name = "ShowGotoNavigator",
            Description = Localizer["ShowGotoNavigatorAttr"],
            Type = "bool",
            ValueList = " — ",
            DefaultValue = "false"
        },
        new AttributeItem() {
            Name = "GotoNavigatorLabelText",
            Description = Localizer["GotoNavigatorLabelTextAttr"],
            Type = "string",
            ValueList = " — ",
            DefaultValue = " — "
        },
        new AttributeItem() {
            Name = "GotoTemplate",
            Description = Localizer["GotoTemplateAttr"],
            Type = "RenderFragment",
            ValueList = " — ",
            DefaultValue = " — "
        },
        new AttributeItem() {
            Name = "PrevPageIcon",
            Description = Localizer["PrevPageIconAttr"],
            Type = "string",
            ValueList = " — ",
            DefaultValue = "fa-solid fa-angle-left"
        },
        new AttributeItem() {
            Name = "PrevEllipsisPageIcon",
            Description = Localizer["PrevEllipsisPageIconAttr"],
            Type = "string",
            ValueList = " — ",
            DefaultValue = "fa-solid fa-ellipsis"
        },
        new AttributeItem() {
            Name = "NextPageIcon",
            Description = Localizer["NextPageIconAttr"],
            Type = "string",
            ValueList = " — ",
            DefaultValue = "fa-solid fa-angle-right"
        },
        new AttributeItem() {
            Name = "NextEllipsisPageIcon",
            Description = Localizer["NextEllipsisPageIconAttr"],
            Type = "string",
            ValueList = " — ",
            DefaultValue = "fa-solid fa-ellipsis"
        }
    };
}

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