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

Cascade event VS select

1 Answer 418 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Jean-François
Top achievements
Rank 1
Jean-François asked on 03 Oct 2013, 02:33 PM
Hi, 

I would like to suggest an improvement concerning events on the DropDownList. 

We wasted a lot of time to figure out that the "select" event is not fired when the value is changed programmatically. This seriously violates the "least surprise" principle. Later we found out about the "cascade" event. But here are a few suggestions : 

* Improve documentation : http://docs.kendoui.com/api/web/dropdownlist#events-cascade. Seems like a copy/paste mistake. Also explain how it differs from select. 
* Improve consistency : in the select event, you use "e.item" to get the selected item while you need to use "this.element" in cascade.
* I'd suggest combining the 2, or if there is a feature about the "cascade" event that I don't see, I think it would be nice for the select event to be fired when changed programmatically. If people need to know wether or not it was from user interaction, a simple "e.fromUser" or something like this would do the trick.

In any case, I just thought that "cascade" was counter-intuitive to use to catch a selection, especially since there is already a "select" event. 

Thank you, 
Jni

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 07 Oct 2013, 08:50 AM
Hello Jni,

 
Thank you for the suggestions. The select event was introduced to provide information about the clicked item. Documentation mentiones that the event is raised when the user selects an item from the popup. We definitely will document that more clearly to avoid such inconveniences. The cascade event was introduced later as part of the cascading functionality and it is raised when widget value is changed either by user interation or with widget API. The selected data item can be get using the dataItem method. Here are my commends on the suggestions:

#1: As I metioned above, we will improve the docs here. I believe that I also described what the difference is.

#2: The "item" argument is the jQuery object which represents the selected item and it is passed as the widget value is still the old one. "this.element" in the scope of the cascade event is the same as the one in the select event. If you need to get information about the selected item in the cascade event handler you can use the dataItem or the select methods.

#3: Combining the two events will be a breaking change for the users which use select event. In order to introduce such change in the behavior, we will need to gather community feedback. I will suggest you open a uservoice discussion. Thus more people will be able to cast their vote for this change.

The cascade event is more like change event. The difference is that the change event is not raised when the value is changed using the widget API.

As a gratitude for your involvement I updated your Telerik points.

Regards,
Georgi Krustev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
DropDownList
Asked by
Jean-François
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or