Autocomplete with "suggest: true" how to get associated dataItem id when user types and hits enter

2 posts, 1 answers
  1. Kerry
    Kerry avatar
    19 posts
    Member since:
    Jul 2013

    Posted 16 Aug 2013 Link to this post

    I am using autocomplete with "suggest: true".  My autocomplete data source is a json array with name and id.  The "name" is used as the dataTextField.  I need to get the associated id with the name that is chosen.  When using "suggest: true" the user can type part of the name and have a selection item appear in the autocomplete box hit enter and never actually select an item from the list.  When this happens how can I get the id associated with the name?

    I am able to get the id when the user selects is from the list.

    I have a jsFiddle with this code at:

  2. Answer
    Kiril Nikolov
    Kiril Nikolov avatar
    2598 posts

    Posted 19 Aug 2013 Link to this post

    Hello Kerry,

    I could achieve this by binding to the close event, and searching the widgets dataSource for the value entered, and then get it's id via the DataItem selected. To make it easier to understand I have prepared a short example using your code and displaying the ID of the selected element on the following jsBin:
    Kiril Nikolov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top