Hello team
while reviewing the syncfusion multiselect dropdown for angular
We have requirement to use multiselect with last option where `user can type` in free form text
for example below ->
Can you please suggest how we can achieve this.
Hello team
to clarify more - we want to provide ability to choose last option and user type himself for whatever he want the option value to be.
<ejs-multiselect id='custom-list' [dataSource]='gameList' [allowCustomValue]=true [mode]='box' [placeholder]='waterMark' [fields]='fields'></ejs-multiselect>
|
Hello Deepak
Thank you
I wonder, if this can be done on checkbox multi-selection drop down
https://ej2.syncfusion.com/angular/demos/#/material/multi-select/checkbox
Thanks
Mohit
<div id="multiselect-sample" class="control-section">
<div class="control-styles">
<h4>Custom Values</h4>
<ejs-multiselect id="custom-list" #custom [dataSource]="gameList" [allowCustomValue]="true" [mode]="box"
(filtering)="onFiltering($event)" [placeholder]="waterMark" [fields]="fields">
<ng-template #noRecordsTemplate>
<div id="nodata">
No matched item, do you want to add it as new item in list?
</div>
<button (click)="addNewItem($event)" class="e-control e-btn">
Add New Item
</button>
</ng-template>
</ejs-multiselect>
</div>
</div>
|
public addNewItem = () => {
// get the typed characters
let customValue: string = ((this
.multiObj as any).filterParent.getElementsByClassName(
'e-input'
)[0] as HTMLInputElement).value;
// make new object based on typed characters
let newItem: { [key: string]: Object } = {
Game: customValue,
Id: customValue
};
// new object added to data source.
(this.multiObj.dataSource as Object[]).push(newItem);
// pass new object to addItem method.
this.multiObj.addItem(newItem);
(this.multiObj as any).listData.push(newItem);
};
|
Thank you Deepak
We will review this
Thanks again for your help and support
Mohit