Hi,
I am providing code which i implemented search filter in dropdown list but not working..
html compnent code
We will validate the requirement in our component. We update you in two business days (May 27th, 2022).
Thanks for update.I will wait for your reply.
Hi Sunil,
We suggest you provide the data source variable name instead of this.data into the filtering event handler method to achieve your requirement.
Please find the code example:
|
[app.component.html] <ejs-dropdownlist id='country' [dataSource]='agreementTypeDatas' [fields]='fields' (filtering)='onFiltering($event)' [filterBarPlaceholder]="filterPlaceholder" [popupHeight]='height' [allowFiltering]='true' [placeholder]='watermark'></ejs-dropdownlist>
[app.component.ts] //define the filtering data public agreementTypeDatas: { [key: string]: Object; }[] = [ { Name: 'Australia', Code: 'AU' }, { Name: 'Bermuda', Code: 'BM' }, { Name: 'Canada', Code: 'CA' }, { Name: 'Cameroon', Code: 'CM' }, { Name: 'Denmark', Code: 'DK' }, { Name: 'France', Code: 'FR' }, { Name: 'Finland', Code: 'FI' }, { Name: 'Germany', Code: 'DE' }, { Name: 'Greenland', Code: 'GL' }, { Name: 'Hong Kong', Code: 'HK' }, { Name: 'India', Code: 'IN' }, { Name: 'Italy', Code: 'IT' }, { Name: 'Japan', Code: 'JP' }, { Name: 'Mexico', Code: 'MX' }, { Name: 'Norway', Code: 'NO' }, { Name: 'Poland', Code: 'PL' }, { Name: 'Switzerland', Code: 'CH' }, { Name: 'United Kingdom', Code: 'GB' }, { Name: 'United States', Code: 'US' } ]; // maps the appropriate column to fields property public fields: Object = { text: 'Name', value: 'Code' }; // set the height of the popup element public height: string = '220px'; // set the placeholder to DropDownList input element public watermark: string = 'Select a country'; // set the placeholder to filter search box input element public filterPlaceholder: string = 'Search'; // filtering event handler to filter a Country public onFiltering: EmitType<FilteringEventArgs> = (e: FilteringEventArgs) => { let query: Query = new Query(); //frame the query based on search string with filter type. query = (e.text !== '') ? query.where('Name', 'startswith', e.text, true) : query; //pass the filter data source, filter query to updateData method. e.updateData(this.agreementTypeDatas, query); }
|
Find the sample here: https://stackblitz.com/edit/angular-eburzs?file=app.component.ts,app.component.html
Find the screenshot here:
|
|
Regards,
Sureshkumar P