AutoComplete : Updating more than one field

4 posts, 0 answers
  1. Chris
    Chris avatar
    6 posts
    Member since:
    Feb 2015

    Posted 25 Mar 2015 Link to this post


    First time posting to the Kendo forum(s).   I've done a lot of searching for this but could not find anything that was a good match.

    I am using an AutoComplete in a cell editor in a KendoGrid.  I assume this is a common use case.  

    My issue. without launching into code/JSFiddle straight away, is that I want to update the data model in the Grid with more than one field from the AutoComplete.  The data that backs the AutoComplete has several fields, one of which is the text field I show in the dropdown, but there's also an id field.  When I select a (text) value from the drop drop I want to update the calling Grid data with the new text AND id (or the data is inconsistent).

    Feel free to direct me at any tutorials or previous answers.  

    I did find this JSFiddle that shows how to get hold of the full data row with a select callback, but I can't see how I get to communicate it back to the Grid data model.

    Apologies if my explanation is unclear.

  2. Chris
    Chris avatar
    6 posts
    Member since:
    Feb 2015

    Posted 25 Mar 2015 in reply to Chris Link to this post

    As an illustration of my issue, please refer to this JSFiddle.

    Here I've got a ComboBox editor in place, but there's an AutoComplete one available in there too.

    Not that the text below the Grid only updates the username.  What I want to do is have the userUrl update too, when making a selection from the editor list.

  3. Georgi Krustev
    Georgi Krustev avatar
    3724 posts

    Posted 27 Mar 2015 Link to this post

    Hi Chris,

    In general, the grid editor can update only one field from the model (as it is bound to only one field). That being said, if you would like to update two model properties, then you will need either modify your grid model structure or manually set the values in the edit event of the grid.

    Here is a demo  ( based on the fiddle you sent that implements the first suggestion (the preferred one).

    Let me know if this does not cover your needs.

    Georgi Krustev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  4. Chris
    Chris avatar
    6 posts
    Member since:
    Feb 2015

    Posted 31 Mar 2015 in reply to Georgi Krustev Link to this post

    Many thanks Georgi.  I will have a look at the demo.  Appreciate you taking the time.

Back to Top