0

I have a PrimeNG dropdown with 1000s of values. So I put in a filter. Now the issue is I want to have a filter with something like "filterMatchMode = startwith" which we have for table filter columns. The default implementation is "contains" which cannot be overridden by the "filterMatchMode" property like we have in tables. Issue with this is that I have multiple values ending in "xyz" and I have a value which is "xyz". So I have to scroll all the way down to select the value. What could be possible solutions?

Current Code which does not solve the problem:

 <p-dropdown [options]="myOptions" [(ngModel)]="selectedModel" filter="true" placeholder="Select a Model"
    [style]="{'width':'200px'}">
</p-dropdown>
Amit
  • 383
  • 3
  • 15

1 Answers1

0

Only thing I can think of is to make a full copy of the primeNG dropdown component to change it. They use a filter method in an objectutils class to filter. This method is using indexOf to do the filtering, you could replace it with contains.

Cyril
  • 254
  • 1
  • 6
  • That would mean duplicating the code to have the required "filter". With this, if the library updates I would need to redo the entire thing. – Amit Dec 17 '18 at 06:35