rocwang/vue-virtual-scroll-grid

[FEATURE REQUEST]

Closed this issue · 4 comments

I think the component should have the following features:

  1. Support manual refresh of the list (for example, it needs to be called after deletion because the search conditions will not be modified, so the refresh will not be automatically triggered).
  2. Expose the loaded data list.
  3. The data list will not be reloaded after the length attribute is set to 0 (I think this is a bug).
    Thank you.

Support manual refresh of the list (for example, it needs to be called after deletion because the search conditions will not be modified, so the refresh will not be automatically triggered).

The grid compoenent (as well asl almost all Vue compoenet) should be props driven driven most of time IMHO. I am not sure adding a "public method" to refresh the compoenent is a good approach here, as it should always reflect the current passed in props to begin with.

Try updating the length and/or pageProvider prop when your data changes (e.g. items are deleted). The prop change should trigger a rendering with the latest data.

Expose the loaded data list.

This is addressed in #314 and will be supported in the next version. It's exposed as allItems to the parent component.

The data list will not be reloaded after the length attribute is set to 0 (I think this is a bug).

The grid component is reactive to the changes of length (as seen in the demo). When it's set to 0, nothing would be rendered, which is expected (by me) here. Not sure if you are talking about the reload of UI here, or the reload of data itmers under the hood. Please provide a minimal example that can reproduce the "bug" if you'd like me to look into it further.

Sorry, I may not have described it clearly.

Based on the demo you provided

Assume that when the server returns no data when Category searches for Mens, I set length to 0, and then set Category to All again, I think the list should be requested again.

In addition, I think the component should also provide a slot to handle the state when the list is empty.

Assume that when the server returns no data when Category searches for Mens, I set length to 0, and then set Category to All again, I think the list should be requested again.

For this case, I think you should update both length and pageProvider. The grid component doesn't do networking by itself. The data providing is delegated to pageProvider.

In addition, I think the component should also provide a slot to handle the state when the list is empty.

I am afraid I don't have the capcity to implement this at the moment. It should be possbile to implement it outside the grid component, by swapping it with your own compoenent when no items to show.