ant-design-blazor/components/table/Table.razor.RowData.cs
James Yeung 726cff7a72 feat(module: table): support paging selection (#341)
* refactor: selection

* feat: add table datasource cache

* feat: support paging selection

* refactor: clean code

* fix: two-way binding for selecteditems
2020-07-10 17:57:20 +08:00

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();
}
}
}