-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Add EmptyContent to Virtualize #38978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,7 @@ public sealed class Virtualize<TItem> : ComponentBase, IVirtualizeJsCallbacks, I | |
private IJSRuntime JSRuntime { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// Gets or sets the item template for the list. | ||
/// Gets or sets the child content for the list. | ||
/// </summary> | ||
[Parameter] | ||
public RenderFragment<TItem>? ChildContent { get; set; } | ||
|
@@ -66,6 +66,12 @@ public sealed class Virtualize<TItem> : ComponentBase, IVirtualizeJsCallbacks, I | |
[Parameter] | ||
public RenderFragment<TItem>? ItemContent { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the `<see cref="RenderFragment" />` that is used when no items are available. | ||
/// </summary> | ||
[Parameter] | ||
public RenderFragment? EmptyContent { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the template for items that have not yet been loaded in memory. | ||
/// </summary> | ||
|
@@ -193,6 +199,11 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) | |
|
||
builder.OpenRegion(3); | ||
|
||
if (EmptyContent is not null && _itemCount == 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't this show the empty content when the list is still being loaded in the event the data source is an Could we also add some tests for this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right, it indeed does. I will rectify that and write some tests. |
||
{ | ||
EmptyContent(builder); | ||
} | ||
|
||
// Render placeholders before the loaded items. | ||
for (; renderIndex < placeholdersBeforeCount; renderIndex++) | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you follow the instructions here: https://github.com/dotnet/aspnetcore/blob/main/docs/APIBaselines.md#publicapiunshippedtxt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes sir. I missed that part of the instructions.