Posted 1 May 2020, 1:59 am EST - Updated 3 October 2022, 4:26 pm EST
Hi Team,
I am using MultiAutoComplete to select multiple items from the drop down list. After selecting the first value multi auto complete doesnt allow to select the second value.
Here is my auto complete code.
<wj-multi-auto-complete #txtTimeWriters
[itemsSourceFunction]=“sourceFunction”
[displayMemberPath]=“‘displayName’”
[selectedValuePath]=“‘userPrincipalName’”
[placeholder]=“‘Timewriters’”
[isEditable]=“true”
ngModel>
sourceFunction = (query: string, max: number, callback: Function) => {
const query_length = query.length; // empty query? no results OR if query length is > 14 (only true if Wijmo AutoComplete is in edit mode) if (!query || query_length > 14) { callback(null); return; } // let strApi; strApi = this.m_strEmployeeApiPath + query + '\')'; return this.m_dbService.getGraphData(strApi) .subscribe ( data => { // find items that start with the user input const allItems = data.value, queryItems = [], rx = new RegExp('^' + query, 'i'); // for (let i = 0; i < allItems.length && queryItems.length < max; i++) { if (rx.test(allItems[i].displayName)) { queryItems.push({ displayName: allItems[i].displayName + ' - ' + allItems[i].department, userPrincipalName: allItems[i].userPrincipalName, officeLocation: allItems[i].officeLocation }); } } callback(queryItems); }, errorCode => { console.log('Http get request to MS Graph failed. ErrorCode: ' + errorCode); } ); }
Appreciate your response.
Thanks