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

Bring empty state to AutoGrid #2895

Open
rbrki07 opened this issue Nov 5, 2024 · 2 comments
Open

Bring empty state to AutoGrid #2895

rbrki07 opened this issue Nov 5, 2024 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers hilla Issues related to Hilla

Comments

@rbrki07
Copy link
Contributor

rbrki07 commented Nov 5, 2024

Describe your motivation

Vaadin 24.5 added an empty state property to the grid component: https://vaadin.com/docs/latest/components/grid#empty-state. It would be great to be able to use this property in AutoGrid as well.

Describe the solution you'd like

<AutoGrid model={EventModel} service={EventService} emptyState={'No events found.'}/>

Describe alternatives you've considered

<AutoGrid model={EventModel} service={EventService}>
  <span slot="empty-state">No events found.</span>
</AutoGrid>

Or

import { useRef, useEffect } from 'react';
import { AutoGrid, AutoGridRef } from '@vaadin/hilla-react-crud';
import EventModel from 'Frontend/generated/com/example/application/entities/EventModel';
import { EventService } from 'Frontend/generated/endpoints';

export default function EventsView() {
  const grid = useRef<AutoGridRef>(null);
  useEffect(() => {
    if (grid.current) {
      grid.current.grid.setEmptyState('No events found.');
    }
  }, [grid]);

  return <AutoGrid ref={grid} model={EventModel} service={EventService} />;
}

Additional context

No response

@rbrki07 rbrki07 added enhancement New feature or request hilla Issues related to Hilla labels Nov 5, 2024
@platosha platosha added the good first issue Good for newcomers label Nov 7, 2024
@platosha
Copy link
Contributor

platosha commented Nov 7, 2024

Adding the emptyState property sounds good. The underlying slotted element could have display: contents; in addition.

@rbrki07
Copy link
Contributor Author

rbrki07 commented Nov 8, 2024

I would like to provide a PR for this.

Why was this PR not merged: vaadin/react-components#248? It would be a good base for implementing this feature request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers hilla Issues related to Hilla
Projects
None yet
Development

No branches or pull requests

2 participants