DropDownList add new

Hi,

is something like the "Add new" shown in the image below possible to achieve with ejs-dropdownlist?


Regards,
Michael

1 Reply 1 reply marked as answer

SN Sevvandhi Nagulan Syncfusion Team April 8, 2021 11:18 AM UTC

Hi Michael, 


Greetings from Syncfusion support. 


We checked your query of “Adding new item to the dropdownlist component”. We suspect that, your requirement would be “adding of typed value to the component if the item not present in the popup list”. We can add the non-present values to the component when filtering the character with the help of using public addItem method and no records template. Kindly refer the following code. 


  public addNewItem = () => { 
    // get the typed characters 
    let customValue: string = (this.dropObj as any).filterInput.value; 
    // make new object based on typed characters 
    let newItem: { [key: string]: Object; } = {'Name': customValue, 'Code': customValue }; 
    // new object added to data source. 
    (this.dropObj.dataSource as Object[]).push(newItem); 
    // pass new object to addItem method. 
    this.dropObj.addItem(newItem); 
} 



Please find the sample below. 




If we misunderstood your requirement, please provide additional details, such as a video illustrating the requirement or common links for reported requirement. 


Regards, 
Sevvandhi N 


Marked as answer
Loader.
Up arrow icon