Save autocomplete key instead of value

Hello, my DataSource is in the form of `{ key: 'hello_world', value: 'Hello World' }` and in the FieldSettings I've added the `{ id: 'key', text: 'value' }` and it's displaying correctly in the dropdown. I would like though when the user selects something to save the id (key) instead of the text. Is this possible?


1 Reply

SP Sureshkumar P Syncfusion Team February 16, 2022 02:11 PM UTC

Hi Stefanos, 
 
You can get the ID (value field) value in the change event argument. The change event will trigger after select the autocomplete value.  
 
Find the code example here: 
 public onChange(args: any): void { 
    console.log(args.value); 
  } 
 
  
 
Regards, 
Sureshkumar P 


Loader.
Up arrow icon