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

[Bug Report][3.5.15] v-data-table headers filter do not work #19596

Closed
jaysonpotter opened this issue Apr 11, 2024 · 5 comments · Fixed by #19881 or Enterprise-CMCS/cmcs-eregulations#1360 · May be fixed by YoutacRandS-VA/desec-stack#2 or manastalukdar/manastalukdar.github.io#411
Labels
C: VDataTable VDatatable T: bug Functionality that does not work as intended/expected

Comments

@jaysonpotter
Copy link

Environment

Vuetify Version: 3.5.15
Last working version: 2.7.2
Vue Version: 3.4.21
Browsers: Chrome 122.0.0.0
OS: Mac OS 10.15.7

Steps to reproduce

Set filter on headers object.

...
{
    text: 'Calories',
    value: 'calories',
    filter: value => {
        if (!this.calories) return true
            return value < parseInt(this.calories)
        },
    },
}
...

Expected Behavior

Entering value in the less than text field below the table should filter results based on desserts calories less than the entered value. Should work just like in the demo for v2 @ https://v2.vuetifyjs.com/en/components/data-tables/#custom-filter

Actual Behavior

Nothing is filtered.

Reproduction Link

https://play.vuetifyjs.com/#...

Other comments

v3 multiple filter criteria workaround: https://codepen.io/jaysonpotter/pen/abxYgbp

@b-maslennikov
Copy link

b-maslennikov commented Apr 12, 2024

did you notice that filter property has FilterFunction | undefined type? docs

export type FilterMatch = boolean | number | [number, number] | [number, number][]
export type FilterFunction = (value: string, query: string, item?: InternalItem) => FilterMatch

@jaysonpotter
Copy link
Author

@b-maslennikov I did. So I tried to update the accepted params in this VPlay, but nothing changed.

Maybe I'm not understanding how I need to use this now, entirely possible. ;) Did you have a working demo using the headers filter approach?

@KaelWD KaelWD added T: bug Functionality that does not work as intended/expected C: VDataTable VDatatable labels Apr 14, 2024
@KaelWD
Copy link
Member

KaelWD commented Apr 14, 2024

Broken in #14728 by 6143358

@stephane303
Copy link
Contributor

stephane303 commented Jun 7, 2024

this broke all my custom filters, investigating ....
everything was working before version 3.6.8

Because I saw the bug and used a workaround, now I am removing the workaround and I should be fine

Using filter-mode solved everything! I am back to a working version !

@stephane303
Copy link
Contributor

Here is the working version: VPlay

Notice the usage of filter-mode="union"

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