mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-06 05:57:39 +08:00
feat(module: table): add OnExpand event (#1208)
This commit is contained in:
parent
16f56f7e9d
commit
d1f1227a4f
@ -191,8 +191,11 @@ namespace AntDesign
|
|||||||
|
|
||||||
private void ToggleTreeNode()
|
private void ToggleTreeNode()
|
||||||
{
|
{
|
||||||
|
bool expandValueBeforeChange = RowData.Expanded;
|
||||||
RowData.Expanded = !RowData.Expanded;
|
RowData.Expanded = !RowData.Expanded;
|
||||||
Table?.Refresh();
|
Table?.OnExpandChange(RowData.CacheKey);
|
||||||
|
if (RowData.Expanded != expandValueBeforeChange)
|
||||||
|
Table?.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FilterSelected(TableFilter<TData> filter)
|
private void FilterSelected(TableFilter<TData> filter)
|
||||||
|
@ -28,6 +28,8 @@ namespace AntDesign
|
|||||||
|
|
||||||
internal void SelectionChanged();
|
internal void SelectionChanged();
|
||||||
|
|
||||||
|
internal void OnExpandChange(int cacheKey);
|
||||||
|
|
||||||
internal void Refresh();
|
internal void Refresh();
|
||||||
|
|
||||||
internal void ReloadAndInvokeChange();
|
internal void ReloadAndInvokeChange();
|
||||||
|
@ -103,6 +103,9 @@ namespace AntDesign
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public Func<RowData<TItem>, string> ExpandedRowClassName { get; set; } = _ => "";
|
public Func<RowData<TItem>, string> ExpandedRowClassName { get; set; } = _ => "";
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public EventCallback<RowData<TItem>> OnExpand { get; set; }
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public SortDirection[] SortDirections { get; set; } = SortDirection.Preset.Default;
|
public SortDirection[] SortDirections { get; set; } = SortDirection.Preset.Default;
|
||||||
|
|
||||||
@ -145,8 +148,17 @@ namespace AntDesign
|
|||||||
int ITable.ExpandIconColumnIndex => ExpandIconColumnIndex;
|
int ITable.ExpandIconColumnIndex => ExpandIconColumnIndex;
|
||||||
int ITable.TreeExpandIconColumnIndex => _treeExpandIconColumnIndex;
|
int ITable.TreeExpandIconColumnIndex => _treeExpandIconColumnIndex;
|
||||||
bool ITable.HasExpandTemplate => ExpandTemplate != null;
|
bool ITable.HasExpandTemplate => ExpandTemplate != null;
|
||||||
|
|
||||||
SortDirection[] ITable.SortDirections => SortDirections;
|
SortDirection[] ITable.SortDirections => SortDirections;
|
||||||
|
|
||||||
|
void ITable.OnExpandChange(int cacheKey)
|
||||||
|
{
|
||||||
|
if (OnExpand.HasDelegate && _dataSourceCache.TryGetValue(cacheKey, out var currentRowData))
|
||||||
|
{
|
||||||
|
OnExpand.InvokeAsync(currentRowData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void ReloadData()
|
public void ReloadData()
|
||||||
{
|
{
|
||||||
PageIndex = 1;
|
PageIndex = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user