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

DropDownList Select event get dataitem

1 Answer 545 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Quynh
Top achievements
Rank 1
Quynh asked on 17 Jun 2015, 10:18 PM

We recently updated to the latest kendoUI 2015.1.429 and noticed a weird issue on the dropdownlist select event.  Here is the code:  

@(Html.Kendo().DropDownListFor(m => m.Deficiency.correctionId)
   .DataTextField("Description")
   .DataValueField("CorrectionId")
   .HtmlAttributes(new { id = "Deficiency_correctionId" })
   .OptionLabel("-- Select Correction --")
   .Events(e => e.Select("onDeficiencyCorrectionDDLSelect").DataBound("CorrectionDDLDataBound"))
   .BindTo(Model.Corrections))
 
function onDeficiencyCorrectionDDLSelect(e) {
        var correction = this.dataItem(e.item.index());
...

When I set an OptionLabel and get the dataItem using e.item.index() in the select event, I get the previous data item in the list.  However, if I removed the index() and just use this.dataItem(e.item); then it works fine.  Also, in cases where I don't use the OptionLabel and in KendoComboBoxes are OK.  Has this changed since the last update?  I ask because we are doing this in many places and also noticed this usage on other posts in this forum as well. 

 Thanks,
Quynh

1 Answer, 1 is accepted

Sort by
0
Plamen Lazarov
Telerik team
answered on 19 Jun 2015, 11:19 AM

Hello Quynh,

You are right - there is a change. In order to support grouping and virtualization, we decided to move the optionLabel outside the items list and place it as a static header on top of the popup element. Please refer to the following article for more information on this subject. 

http://docs.telerik.com/kendo-ui/install/changes-and-backward-compatibility#changes-from-2014-q3-sp2-201431411

 

Regards,
Plamen Lazarov
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
Quynh
Top achievements
Rank 1
Answers by
Plamen Lazarov
Telerik team
Share this question
or