Kendo Jquery Dropdownlist Change Event Firing Unexpectedly

1 Answer 21 Views
DropDownList
Lee
Top achievements
Rank 1
Iron
Veteran
Iron
Lee asked on 30 Jul 2021, 05:47 PM

After changing the data source on a kendo dropdownlist for jquery I am seeing the change event fire upon clicking away from the box without actually selecting anything. Here is the example:

Dojo

To reproduce the error do the following: 

  1. Click on the dropdownlist to expand the options.
  2. Click anywhere off of the list to deselect the list.
  3. Notice that the change event is fired  "Change" is written below the dropdownlist.

How do I work around this?

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 04 Aug 2021, 09:56 AM

Hello, Lee,

The change event is triggered because when using the setDataSource method, the value of the widget is changed to empty string. Following the steps you described, upon clicking away from the list the DropDownList detects a change in its value from Apples to empty string. In order to avoid that, you can reset the value of the DropDownList right after using the setDataSource method. Here is the modified example for reference.

Let me know if you have any further questions.

Regards,
Martin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
DropDownList
Asked by
Lee
Top achievements
Rank 1
Iron
Veteran
Iron
Answers by
Martin
Telerik team
Share this question
or