DropDownList Select event get dataitem

2 posts, 0 answers
  1. Quynh
    Quynh avatar
    1 posts
    Member since:
    Apr 2015

    Posted 17 Jun 2015 Link to this post

    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

  2. Plamen Lazarov
    Admin
    Plamen Lazarov avatar
    135 posts

    Posted 19 Jun 2015 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
Back to Top