mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-02 12:07:44 +08:00
cb88c530a8
* fix(module: table): Correctly deselect all rows in radio selection with a virtualized table * Implement internal inteface method correctly * fix(module: table): Fix correctly rerendering selection components, selecting tree data * Add documentation comments * Fix bind-SelectedRows --------- Co-authored-by: Rhodon <rhodonvantilburg@gmail.com> Co-authored-by: James Yeung <shunjiey@hotmail.com>
59 lines
1.6 KiB
C#
59 lines
1.6 KiB
C#
@namespace AntDesign.Internal
|
|
@typeparam TItem
|
|
@implements IDisposable
|
|
@using AntDesign.TableModels
|
|
|
|
<CascadingValue Value="_blockColumns" Name="AntDesign.Column.Blocked">
|
|
<CascadingValue Value="_rowData" Name="RowData" ChildContent="ChildContent" />
|
|
</CascadingValue>
|
|
|
|
@{ _blockColumns = false; }
|
|
|
|
@code {
|
|
private bool _blockColumns = false;
|
|
|
|
private RowData<TItem> _rowData;
|
|
|
|
[Parameter]
|
|
public RowData<TItem> RowData { get; set; }
|
|
|
|
[Parameter]
|
|
public RenderFragment ChildContent { get; set; }
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
_rowData = RowData;
|
|
_rowData.DataItem.SelectedChanged += OnRowDataSelectedChanged;
|
|
_rowData.ExpandedChanged += OnRowDataExpandedChanged;
|
|
}
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
if (_rowData != RowData)
|
|
{
|
|
_rowData.DataItem.SelectedChanged -= OnRowDataSelectedChanged;
|
|
_rowData.ExpandedChanged -= OnRowDataExpandedChanged;
|
|
_rowData = RowData;
|
|
_rowData.DataItem.SelectedChanged += OnRowDataSelectedChanged;
|
|
_rowData.ExpandedChanged += OnRowDataExpandedChanged;
|
|
}
|
|
}
|
|
|
|
private void OnRowDataSelectedChanged(TableDataItem rowData, bool selected)
|
|
{
|
|
_blockColumns = true;
|
|
InvokeAsync(StateHasChanged);
|
|
}
|
|
|
|
private void OnRowDataExpandedChanged(RowData rowData, bool expanded)
|
|
{
|
|
InvokeAsync(StateHasChanged);
|
|
}
|
|
|
|
void IDisposable.Dispose()
|
|
{
|
|
_rowData.DataItem.SelectedChanged -= OnRowDataSelectedChanged;
|
|
_rowData.ExpandedChanged -= OnRowDataExpandedChanged;
|
|
}
|
|
}
|