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

feat: grid empty state content #6321

Merged
merged 4 commits into from
May 30, 2024
Merged

feat: grid empty state content #6321

merged 4 commits into from
May 30, 2024

Conversation

tomivirkki
Copy link
Member

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

@tomivirkki tomivirkki marked this pull request as draft May 24, 2024 10:01
@tomivirkki tomivirkki marked this pull request as ready for review May 29, 2024 09:37
Comment on lines 5065 to 5087
/**
* 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();
}
Copy link
Contributor

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.

Copy link
Member Author

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

Copy link

sonarcloud bot commented May 29, 2024

Quality Gate Passed Quality Gate passed

Issues
8 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@tomivirkki tomivirkki merged commit 7b814e5 into main May 30, 2024
5 checks passed
@tomivirkki tomivirkki deleted the feat/grid/empty-state branch May 30, 2024 06:40
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.5.0.alpha1 and is also targeting the upcoming stable 24.5.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants