update text of kendo autocomplete with selected item text instead of dataTextField

782 views Asked by At

i am using kendoAutocomplete,Everything is working fine but the problem is that i am searching with dataTextField :"stname" but in template i am showing "label" with is combined with stname and some other value.I need to search with stname only .it is working fine but when i select item from autocomplete it adds the text of selected item.i want to show selected text of label (template) not dataTextField.Is there any way. I have tried with updating its value with label on select event but didn't work for me. Please suggest. Thank you.

$("#street-name").kendoAutoComplete({
                    filter: "startswith",
                    dataTextField: "stname",
                    dataValueField: "value",
                    template:"#=label#",
                    change:function(e)
                    {

                    },

                    select: function (e) {
                  }
});
1

There are 1 answers

0
Ramu Jannu On
$("#street-name").kendoAutoComplete({
    filter: "startswith",
    dataTextField: "stname",
    dataValueField: "value",
    template:"#=label#",
    change:function(e)
    {

    },

    select: function (e) {
        var selecteditem=this.dataItem(e.item.index());                      
    }
});