[object Object] after Autocomplete in a grid

6 posts, 0 answers
  1. con_ssc
    con_ssc avatar
    87 posts
    Member since:
    Apr 2014

    Posted 30 May 2014 Link to this post

    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?
  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 02 Jun 2014 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. con_ssc
    con_ssc avatar
    87 posts
    Member since:
    Apr 2014

    Posted 02 Jun 2014 in reply to Kiril Nikolov Link to this post

    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?
  5. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 02 Jun 2014 Link to this post

    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!
     
  6. Mohamed
    Mohamed avatar
    13 posts
    Member since:
    May 2015

    Posted 30 Sep 2015 in reply to Kiril Nikolov Link to this post

    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.

     

  7. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 02 Oct 2015 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready