This is a migrated thread and some comments may be shown as answers.

AutoComplete : Updating more than one field

3 Answers 173 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 25 Mar 2015, 02:13 PM
Hi,

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.









3 Answers, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 1
answered on 25 Mar 2015, 03:48 PM
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.

0
Georgi Krustev
Telerik team
answered on 27 Mar 2015, 09:31 AM
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  (http://dojo.telerik.com/@ggkrustev/UZAde) based on the fiddle you sent that implements the first suggestion (the preferred one).

Let me know if this does not cover your needs.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Chris
Top achievements
Rank 1
answered on 31 Mar 2015, 10:58 AM
Many thanks Georgi.  I will have a look at the demo.  Appreciate you taking the time.

Chris
Tags
AutoComplete
Asked by
Chris
Top achievements
Rank 1
Answers by
Chris
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or