MultiAutoComplete doesnt allow to select multiple values

Posted by: muhammad.f.mehboob on 1 May 2020, 1:59 am EST

  • 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

  • Posted 4 May 2020, 12:53 am EST

    Hi,

    We are sorry but we were unable to replicate the issue at our end. Below is the sample that we used to replicate the issue:

    https://stackblitz.com/edit/ckkyne-ib66vc

    Feel free to modify the sample so that it reproduces the issue.

    Regards,

    Ashwin

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels