<ejs-multiselect id='custom-list' [dataSource]='gameList' [allowCustomValue]=true [mode]='box' [placeholder]='waterMark' [fields]='fields' [value]='selectedUsers'
(customValueSelection )='onCustomValueSelection($event)' (created)="onCreation()" ></ejs-multiselect> |
public onCustomValueSelection(args){
args.cancel = true;
dropObj.mainList.querySelector('li[datavalue="'+dropObj.inputElement.value+'"]').remove();
dropObj.mainData.pop();
} |
<ejs-multiselect id='custom-list' [dataSource]='gameList' [allowCustomValue]=true [mode]='box' [placeholder]='waterMark' [fields]='fields' [value]='selectedUsers'(select)='onSelection($event)' (created)="onCreation()" ></ejs-multiselect>
|
public onCreation(){ this.selectedUsers = ['Game2'];} |
Hi Sunita,Good day to you.Query 1: if user selected ' Cancel' button in confirmation box - the selected custom value is not removed from the multi-select componentYour provided code is right. But when set the args.cancel as true in customValueSelection it will be added to the list. Because it triggers only after updating the list. So we suggest to you remove the added list and array value manually in the customValueSelection event.[html]
<ejs-multiselect id='custom-list' [dataSource]='gameList' [allowCustomValue]=true [mode]='box' [placeholder]='waterMark' [fields]='fields' [value]='selectedUsers'
(customValueSelection )='onCustomValueSelection($event)' (created)="onCreation()" ></ejs-multiselect>[ts]
public onCustomValueSelection(args){args.cancel = true;dropObj.mainList.querySelector('li[datavalue="'+dropObj.inputElement.value+'"]').remove();dropObj.mainData.pop();
}
Query 2: If a I dynamically add user to "selectedUsers" property from code then it does got gets selected (not displayed as a chip).We are unable to reproduce the reported issue. We have updated the value when the component rendering. In created event dynamically changed the value property value and it works properly. Please refer the below code snippet,[html]
<ejs-multiselect id='custom-list' [dataSource]='gameList' [allowCustomValue]=true [mode]='box' [placeholder]='waterMark' [fields]='fields' [value]='selectedUsers'(select)='onSelection($event)' (created)="onCreation()" ></ejs-multiselect>[ts]
public onCreation(){this.selectedUsers = ['Game2'];
}Please check the below sample for your reference,Regards,Vinoth Kumar S
args.cancel = true;
dropObj.mainList.querySelector('li[datavalue="'+dropObj.inputElement.value+'"]').remove()
dropObj.mainData.pop();
|
let temp: string[]| number[] | boolean[] = this.mulObj.value;
this.mulObj.value = null;
(temp as string[]).push('Game3');
this.mulObj.value = temp;
this.mulObj.dataBind(); |