mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-15 17:31:42 +08:00
726cff7a72
* refactor: selection * feat: add table datasource cache * feat: support paging selection * refactor: clean code * fix: two-way binding for selecteditems
28 lines
658 B
C#
28 lines
658 B
C#
using AntDesign.TableModels;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace AntDesign
|
|
{
|
|
public partial class Table<TItem> : ITable
|
|
{
|
|
private IDictionary<int, RowData<TItem>> _dataSourceCache;
|
|
|
|
private void FlushCache()
|
|
{
|
|
_dataSourceCache ??= new Dictionary<int, RowData<TItem>>();
|
|
_dataSourceCache.Clear();
|
|
}
|
|
|
|
int[] ITable.GetSelectedIndex()
|
|
{
|
|
return _dataSourceCache.Where(x => x.Value.Selected).Select(x => x.Key).ToArray();
|
|
}
|
|
|
|
private void FinishLoadPage()
|
|
{
|
|
_selection?.ChangeOnPaging();
|
|
}
|
|
}
|
|
}
|