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

Grid In-Line edit with AutoComplete results in [object Object]

1 Answer 193 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Jonathan asked on 22 Apr 2015, 02:40 PM

I've got a Grid with a cell that has an editor template that contains an auto complete object.

When the edit for this cell is complete, the grid displays the data as "[object Object]".

If the user goes back and uses the auto complete to select a field, the correct string is passed back to the Grid from the Editor template, however the auto complete functionality becomes buggy. (no javascript errors are thrown)

 Grid Code:

c.Bound(a => a.InputDebtorName).Title("Debtor").EditorTemplateName("InputDebtorName") //Shows valued of [object Object] the first time it is edited, shows correct value if user goes back to edit cell again
    .DataSource(ds => ds.Ajax()
    .Model(m =>
        m.Id(p =>p.InputId);
    .Create(create => create.Action("PendingBatchListingInputCreate", "PendingBatchListing"))
    .Update(update => update.Action("PendingBatchListingInputUpdate", "PendingBatchListing"))
    .Read(r => r.Action("PendingBatchListingInputRead", "PendingBatchListing")

Editor Template Code:

@model object
    function onAdditionalDataDebtorSearch() {
        return {
            debtorName: $("#InputDebtorName").val(),
            clientId: null
    .Placeholder("Select Debtor")
    .DataSource(source =>
        source.Read(read =>
            read.Action("ReadDebtorSearch", "PendingBatchListing")
        "<span>" +
            "#=data.Name#  | #=data.City#, #=data.State#" +

1 Answer, 1 is accepted

Sort by
Nikolay Rusev
Telerik team
answered on 24 Apr 2015, 07:58 AM

Hello Jonathan,


This behavior is due to the fact that you are binding the AutoComplete with objects as data. Thus when you choose a value the field in the Grid will be set as that object instead as the string.


In order to avoid this you should set ValuePrimitive(true) of the AutoComplete. Thus the widget will use the DataTextField, i.e the Name field, from the selected item to set as value of the InputDebtorName.


Nikolay Rusev

See What's Next in App Development. Register for TelerikNEXT.

Asked by
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question