Skip to content

Add ability to get current filtered items in CDataTable #58

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

Closed
CVeniamin opened this issue Feb 12, 2020 · 5 comments
Closed

Add ability to get current filtered items in CDataTable #58

CVeniamin opened this issue Feb 12, 2020 · 5 comments

Comments

@CVeniamin
Copy link

After looking at the docs CDataTable does not have an event that indicates what are the current filtered items after one applies a filter to a specific column or searched in a table.

Hence, after looking at the code I saw that this can be easily achieved by emitting an event after

this.$emit('update:column-filter-value', this.columnFilterState)
and
this.$emit('update:table-filter-value', this.tableFilterState)
for instance

this.$emit('update:table-items', this.currentItems)

The name of the new event is mere indicative.

@woothu
Copy link

woothu commented Feb 12, 2020

Hi! Thank you for this idea!
What are the cases for using such an event?

Btw. 'currentItems' are not filtered items, but visible items. You probably meant 'tableFiltered' or 'sortedItems' (filtered items after applied sorting).

@CVeniamin
Copy link
Author

CVeniamin commented Feb 12, 2020

You are right! Was about to edit the issue since I saw that currentItems are the items visible items as you mentioned...

One of the use cases would be to allow "download" the filtered items to a xlsx/csv file.
I think this can also be achieved through using v-model on a CDataTable instead of an event but requires more code refactoring.

@woothu
Copy link

woothu commented Feb 12, 2020

Very useful use-case! We will add this feature :)

@CVeniamin
Copy link
Author

Awesome!

@woothu
Copy link

woothu commented Feb 12, 2020

Feature introduced in 3.0.0-beta.11, commit: ea92ae7

@woothu woothu closed this as completed Feb 12, 2020
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