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

table: empty-state and loading-distractor should not be shown at the same time #1766

Closed
christian-fischer opened this issue Oct 27, 2020 · 4 comments
Assignees
Labels
feature help wanted Extra attention is needed

Comments

@christian-fischer
Copy link
Contributor

Feature Request

Summary

Both empty-state and loading-distractor are visible in the table at the same time.
This is confusing as usually the empty state does not apply while still loading.

Feature Description

If we defined an empty-state and a loading-distractor for our table, and the table is loading,
the empty state is visible underneath the loading-distractor.

  • This is confusing, as the empty-state usually has a call to action (change filter, timeframe, or something of the sort) - which does not apply while still loading (the user just has to wait until the load finishes to see data).
  • Therefore it makes sense to not show the empty-state while the table is still in loading state.

see https://stackblitz.com/edit/github-dxktnh for a small example demonstrating the current behavior

Attachments

image

@christian-fischer christian-fischer changed the title table: empty-state and loading-distractor shown at the same time table: empty-state and loading-distractor should not be shown at the same time Oct 27, 2020
@tomheller
Copy link
Collaborator

Hi @christian-fischer and thank you for the request.
This would be a good addition to the table. Would you be willing to contribute this feature? I would assume a *ngIf directive on an ng-container for the empty state should do the trick.

<ng-template #emptyStateTemplate>
<ng-content
select="[dtTableEmptyState], dt-empty-state, [dtCustomEmptyState]"
></ng-content>
</ng-template>

Otherwise we would need to check in the setter of the loading state, if we need to show the empty state as well, which could be a little bit tricky in terms of handling the correct state.

@Input()
get loading(): boolean {
return this._loading;
}
set loading(value: boolean) {
this._loading = coerceBooleanProperty(value);
}

@christian-fischer
Copy link
Contributor Author

@tomheller yes, that looks simple and straightforward enough for me ;)
Thanks for pointing me in the right direction - I'll prepare a PR for that....

@ffriedl89 ffriedl89 added the help wanted Extra attention is needed label Oct 28, 2020
@christian-fischer
Copy link
Contributor Author

I think in part this also relates to #287

@ffriedl89
Copy link
Collaborator

Moved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants