primefaces / primevue

Next Generation Vue UI Component Library
https://primevue.org
MIT License
9.99k stars 1.2k forks source link

TreeTable: Filters Object Not Working As Expected #5512

Open incutonez opened 6 months ago

incutonez commented 6 months ago

Describe the bug

The docs say that the filters can be an object, much like in DataTable. But in the example below, it looks like that's not possible, or maybe it needs to be done differently in a TreeTable? If so, it'd be nice if the docs showed an example of how to do this.

Reproducer

https://stackblitz.com/edit/flct7f?file=src%2FApp.vue

PrimeVue version

3.50.0

Vue version

3.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

  1. Go to Fiddle
  2. Notice that no data shows
  3. Replace line 70 in App.vue with name: 'vue' instead of an object
  4. Notice that data now shows

Expected behavior

I would expect the object version to work like it does in DataTable, as it looks like it's the same signature.

m-meier commented 5 months ago

Looks like you're right. The code only accepts pure "columnname":"stringvalue" combinations for the filters prop. However you can define the filterMatchMode as a property on the column, for example <Column field="name" header="Name" expander filterMatchMode="equals">

incutonez commented 5 months ago

However you can define the filterMatchMode as a property on the column, for example <Column field="name" header="Name" expander filterMatchMode="equals">

@m-meier, yeah, I saw that, but I have more dynamic filters that I would rather update the object than having to recompute the column definitions to set a single property. Also, it seems like it should be more normalized between the tables, so we don't really have to remember if filters are done this way or that way... much better for common architecture, but that's my 2 cents.