mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-06 05:57:39 +08:00
63d09f76a5
* feat: add pagination and empty * fix: indent * feat(module: table): add checkbox selection * feat(module: table): add radio selection * feat: add selected rows
71 lines
3.3 KiB
C#
71 lines
3.3 KiB
C#
@namespace AntDesign
|
|
@inherits AntDomComponentBase
|
|
@typeparam TItem
|
|
|
|
<div class="ant-table-wrapper">
|
|
<Spin Spinning="Loading">
|
|
@if (ShowPagination && PaginationPosition.Contains("top"))
|
|
{
|
|
<Pagination Class="@PaginationClass"
|
|
Total="Total"
|
|
PageSize="PageSize"
|
|
Current="PageIndex"
|
|
OnPageIndexChange="HandlePageIndexChange"
|
|
OnPageSizeChange="HandlePageSizeChange" />
|
|
}
|
|
|
|
<CascadingValue Value="@this" TValue="ITable">
|
|
<div class="ant-table">
|
|
<div class="ant-table-container">
|
|
<div class="ant-table-content">
|
|
<table style="table-layout: auto;">
|
|
<colgroup></colgroup>
|
|
<thead class="ant-table-thead">
|
|
<tr>
|
|
<CascadingValue Name="IsHeader" Value="true">
|
|
@if (_fieldModel != null)
|
|
{
|
|
@ChildContent(_fieldModel)
|
|
}
|
|
</CascadingValue>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="ant-table-tbody">
|
|
@if (ActualTotal <= 0)
|
|
{
|
|
<tr class="ant-table-placeholder">
|
|
<td colspan="6" class="ant-table-cell">
|
|
<Empty Simple />
|
|
</td>
|
|
</tr>
|
|
}
|
|
else if (ShowItems != null && _columns.Count > 0)
|
|
{
|
|
for (int i = 0; i < ShowItems.Count(); i++)
|
|
{
|
|
var data = ShowItems.ElementAt(i);
|
|
var @checked = HeaderSelection?.RowSelections.ElementAtOrDefault(i)?.Checked??false;
|
|
<CascadingValue Value="i" Name="Index">
|
|
<tr class="ant-table-row ant-table-row-level-0 @(@checked ? "ant-table-row-selected" : "")">
|
|
@ChildContent(data)
|
|
</tr>
|
|
</CascadingValue>
|
|
}
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</CascadingValue>
|
|
@if (ShowPagination && PaginationPosition.Contains("bottom"))
|
|
{
|
|
<Pagination Class="@PaginationClass"
|
|
Total="Total"
|
|
PageSize="PageSize"
|
|
Current="PageIndex"
|
|
OnPageIndexChange="HandlePageIndexChange"
|
|
OnPageSizeChange="HandlePageSizeChange" />
|
|
}
|
|
</Spin>
|
|
</div> |