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

autocomplete in grid popup editor template.

1 Answer 352 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Todd
Top achievements
Rank 1
Todd asked on 01 Jun 2017, 01:40 PM

I'm having difficulty using the autoComplete in a popup editor template.when the datasource for the autocomplete has separate value and text fields.

This example works fine if we use the firstName for both the data-value-field and data-text-field.

However, if we change the datasource to include a "fullname" property:

var autoCompleteDS = new kendo.data.DataSource({
    data: [
        {firstName: "Alex", fullName:"Alex Smith"},
        {firstName: "Alice", fullName:"Alice Smith"},
        {firstName: "Antony", fullName:"Antony Smith"},
        {firstName: "Anne", fullName:"Anne Smith"},
        {firstName: "Anna", fullName:"Anna Smith"}
    ]
});

 

And configure the autocomplete to reference this property:

<input name="FirstName"
        data-bind="value:FirstName"
        data-value-field="firstName"
        data-text-field="fullName"
        data-source="autoCompleteDS"
        data-role="autocomplete" />

 

When we add a record, the record's firstName field is set to the fullName.  I obviously have the binding specified incorrectly but I can't figure out what I've done wrong.

 

Thanks,

Todd

 

 

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 05 Jun 2017, 07:54 AM
Hello Todd,

The demonstrated result is expected because the AutoComplete widget does not support dataValueField property and the dataText property is used to bind the AutoComplete value with the FirstName field of the Grid:

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

Let me know if you need additional assistance on this matter.

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Todd
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or