Completed
Last Updated: 07 Mar 2014 14:48 by ADMIN
Franz
Created on: 04 Mar 2014 14:41
Category: Kendo UI for jQuery
Type: Feature Request
1
Pass the dataitem in the event argument of the DropDownList's select handler
The select event of the DropDownList passes an event argument e. One of the members of said argument is e.item.

Contrary to what every sane developer expects, e.item is *not* the dataItem of the datasource bound to the DropDownList, but the DOM element that represents the item visually.

The way to get to the data item is *undocumented*. Here's the necessary code:

domElem.kendoDropDownList({
    
    /*  ...  */

    select: function(e){
        var dataItem = e.sender.dataItem(e.item.index());
        // ARE YOU KIDDING ME?
    }
});


Please, PLEASE, pass the data item in the event argument.

I can't think of any case in which i would prefer the DOM element in the select handler over the data item.
1 comment
ADMIN
Telerik Admin
Posted on: 07 Mar 2014 14:48
Thank you for the feedback.

I want to explain why we designed and implemented the event handler in this way.

The Select event of the widget is fired when you select an item from the available list of items. This is because we pass the selected item in the respective event handler. We also provided a way to reference the data item which responds to it (as you discovered) via the widget API.

Given that, I'm marking this item as completed.