Should be straightforward but I need to know if we can filter the dropdown datasource which is a flat array in my case by contains query filter? By default, it uses startsWith. I followed the examples for filtering in the documentation but everywhere we are using array of objects with some property to pass to Query object.
My data source is ["Mango", "Apple", "Banana"]
If i type 'ppl' it should return Apple
This is what I have currently but not working -
ejs-dropdownlist #fruitNames width="440" [allowFiltering]='true' id='fruitName' name="fruit" [dataSource]='fruitsList'
[(ngModel)]='selectedFruit' (filtering)='onFiltering($event)' (select)="onFruitSelect($event, null)" placeholder='Select Fruit*'
required>
</ejs-dropdownlist>
public onFiltering: EmitType<any> = (e: FilteringEventArgs) => {
console.log(e.text);
// load overall data when search key empty.
if (e.text === '') {
e.updateData(this.fruitsList);
} else {
let query: Query = new Query();
// change the type of filtering
query = (e.text !== '') ? query.where(this.fruitsList, 'contains', e.text, true) : query;
e.updateData(this.fruitsList, query);
}
};