Skip to content
  • Sponsor coreui/coreui-vue

  • Notifications You must be signed in to change notification settings
  • Fork 131

Add ability to get current filtered items in CDataTable  #58

Closed
@CVeniamin

Description

@CVeniamin

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.

Activity

woothu

woothu commented on Feb 12, 2020

@woothu

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

CVeniamin commented on Feb 12, 2020

@CVeniamin
Author

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

woothu commented on Feb 12, 2020

@woothu

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

CVeniamin

CVeniamin commented on Feb 12, 2020

@CVeniamin
Author

Awesome!

woothu

woothu commented on Feb 12, 2020

@woothu

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Add ability to get current filtered items in CDataTable · Issue #58 · coreui/coreui-vue