We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

AutoComplete Selected Item

According to the sample, the selectedItem of the collection should be set in the change method of the autocomplete control.  This does not appear to work.  An args parameter is passed, but there does not appear to be an itemId property on the args object.  It looks like this should be the item # of the collection.  The selectedItem is not being set as is setup in the sample app.  Is this a known issue or am I missing something?

change: function (args) { contentItem.value.selectedItem = contentItem.value.data[args.itemId];} });

There is no itemId on the args object.

Thank you,
Binu Agrawal

1 Reply

FP Francis Paul Antony Raj Syncfusion Team November 11, 2015 12:58 PM UTC

Hi Binu,


Thanks for contacting Syncfuision support.

You can get the selected Item’s id in the args of “select” event. Item id cannot be taken from args of Change event since every item is associated with its own id and change event may also rises due to incomplete texts in the autocomplete box. Please refer the following code snippet.


input.ejAutocomplete({dataSource: contentItem.value.data,

            fields: { text:label,key:value },

            select: function (args) { contentItem.value.selectedItem = contentItem.value.data[args.key];} });


To know more about Autocomplete component properties, methods, and events, refer to the below link.

http://help.syncfusion.com/js/api/ejautocomplete


Regards,

Francis Paul A


Loader.
Live Chat Icon For mobile
Up arrow icon