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

[object Object] after Autocomplete in a grid

5 Answers 187 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
CS
Top achievements
Rank 2
CS asked on 30 May 2014, 01:27 PM
I have an autocomplete bound as a custom editor on a grid cell. I get the correct set of options from the autocomplete an select one. Now when I leave the cell the selection gets replaced with [object Object], when I edit the cell again it is the value as before again. At what point gets the display value of the cell replaced? Do I have to copy the schema for the autocomplete datasource from the grid datasource?

5 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 02 Jun 2014, 07:44 AM
Hello Stefan,

Most probably the problem is due to incorrect dataTextField and dataValueField configurations of the AutoComplete widget. I have created an example that you can use as a reference:

http://jsbin.com/zulux/1/edit

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
CS
Top achievements
Rank 2
answered on 02 Jun 2014, 08:45 AM
Hello Kiril,

ok that seems to work, although I do not understand what is bound by dataTextField  and what by dataValueField . Is there a better reference than http://docs.telerik.com/kendo-ui/getting-started/framework/mvvm/bindings/value because that doesn't quite deliver enough information in my case.
My questions is, what gets displayed and what gets bound to the model and where? Is the dataValueField added to the options.field as a property called dataTextField?
0
Kiril Nikolov
Telerik team
answered on 02 Jun 2014, 01:06 PM
Hi Stefan,

The dataTextField is a config property of the widget that is explained in the API reference:

http://docs.telerik.com/kendo-ui/api/web/autocomplete#configuration-dataTextField

In the example the data-value-field property is not needed as it is not a complex widget and it only has text field. You can also use only JavaScript initialization, if you do not like the data attributes, here is the updated example:

http://jsbin.com/zulux/2/edit

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Mohamed
Top achievements
Rank 1
answered on 30 Sep 2015, 10:26 PM

I'm having the same problem with a data-set returning json data, if I select a value from the suggested list it shows [object Object], which is the case in your example as well.

 

0
Kiril Nikolov
Telerik team
answered on 02 Oct 2015, 07:54 AM

Hello Mohamed,

 

I am afraid that the issue is not a known one, nor is reproducible in our online demos, so please extract a runnable sample in a Kendo UI Dojo and we will be happy to help.

 

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
AutoComplete
Asked by
CS
Top achievements
Rank 2
Answers by
Kiril Nikolov
Telerik team
CS
Top achievements
Rank 2
Mohamed
Top achievements
Rank 1
Share this question
or