-
Notifications
You must be signed in to change notification settings - Fork 66
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
feat: grid empty state content #6321
Conversation
0f3fca3
to
998c70e
Compare
998c70e
to
d6e8611
Compare
/** | ||
* Sets the component to be displayed when the grid is empty. | ||
* | ||
* @param emptyStateComponent | ||
* the component to be displayed when the grid is empty | ||
*/ | ||
public void setEmptyStateComponent(Component emptyStateComponent) { | ||
this.emptyStateText = null; | ||
this.emptyStateComponent = emptyStateComponent; | ||
updateEmptyStateContent(); | ||
} | ||
|
||
/** | ||
* Sets the text to be displayed when the grid is empty. | ||
* | ||
* @param emptyStateText | ||
* the text to be displayed when the grid is empty | ||
*/ | ||
public void setEmptyStateText(String emptyStateText) { | ||
this.emptyStateComponent = null; | ||
this.emptyStateText = emptyStateText; | ||
updateEmptyStateContent(); | ||
} |
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.
Should the Javadoc mention that calling one setter will remove whatever has been defined by the other setter? I think that, generally, a setter is understood as an overriding task, but since in this case, we have two different setters around the same feature, we could make it clearer.
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.
Makes sense, updated the documentation
Quality Gate passedIssues Measures |
vaadin-grid-flow-parent/vaadin-grid-flow/src/main/java/com/vaadin/flow/component/grid/Grid.java
Show resolved
Hide resolved
This ticket/PR has been released with Vaadin 24.5.0.alpha1 and is also targeting the upcoming stable 24.5.0 version. |
Description
Depends on vaadin/web-components#7429
Add empty state API to
Grid
:setEmptyStateComponent
setEmptyStateText
getEmptyStateComponent
getEmptyStateText
Setting empty state content to the
Grid
makes it display the content whenever there are no items to render.Part of vaadin/platform#5719
Type of change
Feature