Hi,
I have a vaadin grid (version 2.0.2) with 10 columns and has a horizontal scrollbar, I would like to show a message like "You do not have any active xxx etc..". if no items found on grid.
I can add this message below to the vaagin-grid, but showing the message below the horizontal scrollbar!!! (my vaadin grid has horizontal scrollbar)
Would be an option to show the message on top of the grid, using CSS positioning? You could toggle the visibility of that message/element using data binding.
Yes, would be a nice feature. Although as @jouni mentioned you can go with:
<template is="dom-if" if="[[!data.length]]">
<div class="data-not-found">No data available</div>
</template>
where data-not-found can be absolutely positioned on top of the grid.
The need for such a message is project-specific, e. g. some users would rather prefer to not show grid at all if there are no items. So the use case seems very uncommon, and the message can easily be displayed like suggested in the above comment, without affecting the grid scroller internals. Therefore I am closing this issue.
Not sure if the case, where filtering causes the grid to not render any items, should be considered here? How can a developer show a “no items found” message in that case?
@jouni I see your point. Yes, that is a valid use case. I was previously working on the brainy-table and came up with solution similar to what you ask about. We probably should consider this as well, so I reopen this issue. Thank you for pointing out.
Having a slot for which the content is displayed if there are no rows would be useful, as it likely also simplifies the Flow integration of this feature.
The option to add a component would be the preferred one for me, so I can, for example, add a button to add a new item, clear the filtering etc.
Closing as duplicate of #671
Most helpful comment
Having a slot for which the content is displayed if there are no rows would be useful, as it likely also simplifies the Flow integration of this feature.
The option to add a component would be the preferred one for me, so I can, for example, add a button to add a new item, clear the filtering etc.