0
votes

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.

1
Use custom sorting method - how would you expect table to compare 2 objects of unknown structure by itself huh? - Antoniossss
Thanks for replying so quickly. Obviously, implementation similar to Sorting example (primefaces.org/primeng/#/table/sort) should solve the case. - Tihomir
@Antoniossss: this solution works for sorting but not for global filter. - Tihomir

1 Answers

2
votes

I think this should works:

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

Add other fields if you want :

'engine.type', 'engine.power'