Skip to content
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

Blazor Virtualize: Empty Rows Template #28770

Closed
jlchavez opened this issue Dec 21, 2020 · 10 comments · Fixed by #49185
Closed

Blazor Virtualize: Empty Rows Template #28770

jlchavez opened this issue Dec 21, 2020 · 10 comments · Fixed by #49185
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-blazor-virtualization This issue is related to the Blazor Virtualize component good first issue Good for newcomers. help wanted Up for grabs. We would accept a PR to help resolve this issue
Milestone

Comments

@jlchavez
Copy link

jlchavez commented Dec 21, 2020

Currently when the ItemsProvider returns zero count it will display nothing, an EmptyContent template would improve the usability for the end user so that it knows that there is no data and the loading has been completed. This would reduce workarounds as checkinf if the ItemsProvider has returned Total Rows = 0, adding conditions to display this message and calling StateHasChanged() so that it can be repainted.

@typeparam TItem
<table><tbody>
    <Virtualize Context="item" ItemsProvider="@LoadData" TItem="TItem">
        <Placeholder>
            <tr><td><p><i class="fas fa-spin fa-spinner"></i> Loading...</p></td></tr>
        </Placeholder>
        <EmptyContent>
            <tr><td><p>No data available</p></td></tr>
        </EmptyContent>
        <ItemContent>
            <tr @key="item">@RowTemplate(item)</tr>
        </ItemContent>
    </Virtualize>
 </tbody></table>
@pranavkm pranavkm added the area-blazor Includes: Blazor, Razor Components label Dec 21, 2020
@mkArtakMSFT mkArtakMSFT added feature-blazor-virtualization This issue is related to the Blazor Virtualize component enhancement This issue represents an ask for new feature or an enhancement to an existing one labels Dec 23, 2020
@mkArtakMSFT mkArtakMSFT added this to the Next sprint planning milestone Dec 23, 2020
@ghost
Copy link

ghost commented Dec 23, 2020

Thanks for contacting us.
We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@SteveSandersonMS SteveSandersonMS added affected-medium This issue impacts approximately half of our customers severity-major This label is used by an internal tool labels Jan 26, 2021 — with ASP.NET Core Issue Ranking
@ghost
Copy link

ghost commented Jul 20, 2021

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@TanayParikh TanayParikh modified the milestones: Backlog, .NET 7 Planning Oct 19, 2021
@TanayParikh TanayParikh added the Priority:2 Work that is important, but not critical for the release label Oct 21, 2021
@mkArtakMSFT mkArtakMSFT modified the milestones: .NET 7 Planning, Backlog Nov 11, 2021
@ghost
Copy link

ghost commented Nov 11, 2021

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@pranavkm pranavkm modified the milestones: Backlog, .NET 7 Planning Nov 18, 2021
@pranavkm pranavkm modified the milestones: .NET 7 Planning, Backlog Nov 18, 2021
@ghost
Copy link

ghost commented Nov 18, 2021

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@pranavkm pranavkm added good first issue Good for newcomers. and removed severity-major This label is used by an internal tool affected-medium This issue impacts approximately half of our customers Priority:2 Work that is important, but not critical for the release labels Nov 18, 2021
@szalapski
Copy link

szalapski commented Feb 27, 2022

@jlchavez, @pranavkm, and others, I think an EmptyContent template might make sense when using an ItemsProvider, but I'm not so sure adding a EmptyContent is a real improvement over a conditional in the more common case of using the Items parameter. In the interest of keeping the component more focused, are we sure we want this feature? Part of the elegance of this component is that it is a drop-in replacement for a @foreach block with very little other features to possibly confuse or be concerned about.

In the case of not using an ItemsProvider, are you are advocating for:

<Virtualize Context="item" Items="Data">
    <EmptyContent>
        <tr><td><p>No data available</p></td></tr>
    </EmptyContent>
    <ItemContent>
        <tr @key="item">@RowTemplate(item)</tr>
    </ItemContent>
</Virtualize>

...over the current equivalent:

@if (Data.Any()){ 
    <Virtualize Context="item" ItemsProvider="@LoadData" TItem="TItem">
        <tr @key="item">@RowTemplate(item)</tr>
    </Virtualize>
}
else {
     <tr><td><p>No data available</p></td></tr>
}

I think I'd prefer the latter.

@jlchavez
Copy link
Author

jlchavez commented Feb 28, 2022

I would say that good developers follow development principals that will make code cleaner, efficient and less prone to errors, and a good example is the DRY principle, dont't repeat your self. That's why we have components like Virtualize that reduce complexities, without having to copy/paste spaghetti code.

Adding the EmptyContent and a LoadingContent would remove duplicating code in every grid in your app, but you can still do it the coded way if you like to.

@szalapski
Copy link

szalapski commented Feb 28, 2022

Are you saying the example I gave above has duplicated code? Or is there another example I can look at that illustrates your point?

@thalaeg
Copy link

thalaeg commented Apr 5, 2022

@jlchavez, @pranavkm, and others, I think an EmptyContent template might make sense when using an ItemsProvider, but I'm not so sure adding a EmptyContent is a real improvement over a conditional in the more common case of using the Items parameter. In the interest of keeping the component more focused, are we sure we want this feature? Part of the elegance of this component is that it is a drop-in replacement for a @foreach block with very little other features to possibly confuse or be concerned about.

In the case of not using an ItemsProvider, are you are advocating for:

<Virtualize Context="item" Items="Data">
    <EmptyContent>
        <tr><td><p>No data available</p></td></tr>
    </EmptyContent>
    <ItemContent>
        <tr @key="item">@RowTemplate(item)</tr>
    </ItemContent>
</Virtualize>

...over the current equivalent:

@if (Data.Any()){ 
    <Virtualize Context="item" ItemsProvider="@LoadData" TItem="TItem">
        <tr @key="item">@RowTemplate(item)</tr>
    </Virtualize>
}
else {
     <tr><td><p>No data available</p></td></tr>
}

I think I'd prefer the latter.

I think your examples are mixing up the two. The second one using the ItemsProvider wouldn't have Data before querying. So that is why the EmptyTemplate is better inside.

If instead you meant for it to say Items (and therefore comparable examples) I think the EmptyTemplate (aka the first example) way looks cleaner.

The Virtualization component should have everything it needs to tell if it is empty or not, why not give that data back to a user to choose to use or not.

@mkArtakMSFT mkArtakMSFT added the help wanted Up for grabs. We would accept a PR to help resolve this issue label Oct 5, 2022
@mkArtakMSFT mkArtakMSFT modified the milestones: Backlog, .NET 8 Planning Oct 5, 2022
@ghost
Copy link

ghost commented Oct 5, 2022

Thanks for contacting us.

We're moving this issue to the .NET 8 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@ghost
Copy link

ghost commented Jun 29, 2023

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@ghost ghost locked as resolved and limited conversation to collaborators Aug 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-blazor-virtualization This issue is related to the Blazor Virtualize component good first issue Good for newcomers. help wanted Up for grabs. We would accept a PR to help resolve this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants