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

Get dataValueField(s) for the selected items of Autocomplete control in change event.

2 Answers 1043 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
GopalaPandian
Top achievements
Rank 1
GopalaPandian asked on 26 Mar 2021, 07:02 AM

I have a Autocomplete kendo control. I am selecting some values by doing a filtering after selecting 5 items as shown in the attached image. I am able to retrieve value after individual selection. But I want to get dataValueField for the all the selected items of Autocomplete control in change event. Please find the below code. Kindly suggest in this

$("#Products").kendoAutoComplete({
                        dataSource: result,
                        dataTextField: "TagName",
                        dataValueField:"TagID",
                        filter: "startswith",
                        placeholder: "Select Product...",
                        separator: ", ",
                        select: function (e) {
                            if (e.dataItem) {
                                var dataItem = e.dataItem;
                                alert(dataItem.TagID);//Returns dataValueField value for individual selected item
                                alert(dataItem.TagName);//Returns dataTextField value for individual selected item
                            }
                            if (e.item)
                            {
                                //var dataItem = e.dataItem;
                                var item = e.item;
                                var text = item.text();  //Returns dataTextField value for individual selected item                              
                            }
                        },
                        change: function (e) {
                            alert($("#Products").data("kendoAutoComplete").value());//Returns dataTextField value for multiple selected items
                            var s=$("#Products").data("kendoAutoComplete").value(); //Returns dataTextField value for multiple selected items
                           //Need to get dataValueField for multiple selected items
                        }
                    });

 

2 Answers, 1 is accepted

Sort by
0
Stoyan
Telerik team
answered on 31 Mar 2021, 07:10 AM

Hello GopalaPandian,
Thank you for your inquiry.

I am currently creating a working sample of a possible solution. However I am going to need some additional time. I will send it to you as soon as possible. 

Thank you for your patience in advance. 

Regards,
Stoyan
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Stoyan
Telerik team
answered on 31 Mar 2021, 05:28 PM

Hi Gopala,
Thank you for your patience.

The AutoComplete Widget doesn't expose a dataValueField configuration property. Review the Widget's API docs to see all available methods for it.

I have used the code you shared to recreate the scenario at hand. However, I was unable to reproduce the experienced behavior in this Dojo. Have I missed something?

If the issue persists please consider providing more details about the scenario or recreate it with the linked Dojo.

Regards,
Stoyan
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
AutoComplete
Asked by
GopalaPandian
Top achievements
Rank 1
Answers by
Stoyan
Telerik team
Share this question
or