autocomplete in grid popup editor template.

2 posts, 0 answers
  1. Todd
    Todd avatar
    1 posts
    Member since:
    Nov 2016

    Posted 01 Jun 2017 Link to this post

    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

     

     

  2. Stefan
    Admin
    Stefan avatar
    2880 posts

    Posted 05 Jun 2017 Link to this post

    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.
Back to Top