Search code examples
angularprimengprimeng-turbotable

Global filter in primeng p-table doesn't work for complex row data


Primefaces primeng filter p-table example - global filtering doesn't work for complex data. Example uses model:

export interface Car {
vin?;
year?;
brand?;
color?;
price?;
saleDate?;    
}

If we add field engine to car interface:

export interface Engine {
type?;
power?;
atRpm?;
}

And add column Engine to the template to display rowData.engine.type data, global filter is not working for this column. How to solve this?

I'd prefer to avoid data flattening if possible. Because it should be done on large amount of data and the original model is productively used in application.


Solution

  • I think this should works:

    [globalFilterFields]="['engine.type']"
    

    Add other fields if you want :

    'engine.type', 'engine.power'