[FIXED] PrimeNG – column filtering and languages with tones/accents

Issue

I want to perform filtering into columns of a table that contains data in Greek language.

Unfortunately the <p-columnFilter> component internally does not seem to recognize the characters with tones to be the same with the same character without a tone. For example a vowel with a tone (ή) is not matched with the same vowel witout tone (η).

Example with pictures below:

1) Filtering using the tone ή

1) Filtering using the tone ή

2) Filtering without using the tone η (which does not match with ή)

Filtering without using the tone η (which does not match with ή)

In most filters out there on the web, characters with tone are matched with the same characters without tone and vice versa, how can I achieve the same here? Maybe if I could use the localeCompare function as filter function as an attribute in the columnFilter, but the documentation is not detailed in the table filtering section

I posted the same question in their github repository but I have not received any answer yet.

Solution

After reading their documentation, it looks like they don’t expose their p-columnFilter component, nor is there an eventEmitter to get value changes on the input fields.

The fastest way to resolve your issue would be using their filter service and writing a custom filtering like this. (I used locale-contains library for this one):
https://stackblitz.com/edit/primeng-filterservice-demo-qv3t3k?file=src%2Fapp%2Fapp.component.ts

Answered By – Can Geylan

Answer Checked By – Gilberto Lyons (Easybugfix Admin)

Leave a Reply

(*) Required, Your email will not be published