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

Add prop for empty state rendering #20

Closed
dextermb opened this issue Nov 21, 2018 · 6 comments
Closed

Add prop for empty state rendering #20

dextermb opened this issue Nov 21, 2018 · 6 comments

Comments

@dextermb
Copy link
Contributor

I think that it would be nice to have a prop named something along the lines of emptyStateRender which would allow you to pass in a:

  • Function
  • Element
  • String

If a function or element is passed then it should return those rather than showing the table with "no data", if a string is passed then it'd just change the empty message.

Thoughts?

cc @NilesB @DivineOmega @JacobBrassington @wheatleyjj

@DivineOmega
Copy link
Contributor

@dextermb There is a prop called noDataMessage that does what you request, if passed a string. It is currently undocumented (#2).

It does not support being passed a function or element (component?).

@dextermb
Copy link
Contributor Author

@DivineOmega Nice. Yeah a valid react element (React.isValidElement) would be a nice option to have

@dextermb
Copy link
Contributor Author

dextermb commented Nov 26, 2018

@DivineOmega What are you thoughts on this? I've come across a situation where I want to render something else while no data is present, but using the AJAX datatable so I cannot do:

If empty render placeholder
If not empty render table

As the table itself calls the data.

cc @NilesB

@DivineOmega
Copy link
Contributor

@dextermb Perhaps have a separate noDataComponent prop that replaces the table if present?

@dextermb
Copy link
Contributor Author

@dextermb Perhaps have a separate noDataComponent prop that replaces the table if present?

Maybe emptyState?

@DivineOmega
Copy link
Contributor

state perhaps isn't the best term to use, due to possible confusion with React Component state.

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

No branches or pull requests

2 participants