Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/BootstrapBlazor/Components/Table/Table.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,11 @@ protected override void OnParametersSet()
{
base.OnParametersSet();

if (ScrollMode == ScrollMode.Virtual && IsTree)
{
throw new InvalidOperationException($"{GetType()} does not support virtual scrolling in tree mode. ${GetType()} 目前不支持虚拟滚动模式下设置 IsTree=\"true\"");
}

OnInitParameters();

if (Items != null && OnQueryAsync != null)
Expand Down
8 changes: 8 additions & 0 deletions test/UnitTest/Components/TableTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2693,6 +2693,7 @@ public void ScrollMode_Ok()
var localizer = Context.Services.GetRequiredService<IStringLocalizer<Foo>>();
var cut = Context.RenderComponent<BootstrapBlazorRoot>(pb =>
{
pb.Add(a => a.EnableErrorLogger, false);
pb.AddChildContent<Table<Foo>>(pb =>
{
pb.Add(a => a.RenderMode, TableRenderMode.Table);
Expand All @@ -2710,6 +2711,13 @@ public void ScrollMode_Ok()
});
var virtualComponent = cut.FindComponent<Virtualize<Foo>>();
Assert.NotNull(virtualComponent);

var table = cut.FindComponent<Table<Foo>>();
var exception = Assert.Throws<InvalidOperationException>(() => table.SetParametersAndRender(pb =>
{
pb.Add(a => a.IsTree, true);
}));
Assert.NotNull(exception);
}

[Fact]
Expand Down