I have a dropdownlist with an option label and a number of items. When I use list.dataItem() it seems to return the next index, not the currently selected index.
This problem seems only to occur when an optionLabel is used and can be reproduced in the cascading drop down list demo in the following way.
Place a break point at the bottom of the categories change function:
Then select an item in the categories drop down, such as, confections. When the break point is hit, add a watch to $('#categories').data('kendoDropDownList').dataItem();
It is expected that the dataItem will be confections, but it is actually Diary Products.
Thanks
This problem seems only to occur when an optionLabel is used and can be reproduced in the cascading drop down list demo in the following way.
Place a break point at the bottom of the categories change function:
$("#categories").kendoDropDownList({ optionLabel: "Select category...", dataTextField: "CategoryName", dataValueField: "CategoryID", dataSource: { type: "odata", serverFiltering: true, transport: { read: "http://demos.kendoui.com/service/Northwind.svc/Categories" } }, change: function () { var value = this.value(); if (value) { productsDataSource.filter({ field: "CategoryID", operator: "eq", value: parseInt(value) }); products.enable(); } else { products.enable(false); } products.select(0); orders.select(0); orders.enable(false); <--- BREAK HERE } });
Then select an item in the categories drop down, such as, confections. When the break point is hit, add a watch to $('#categories').data('kendoDropDownList').dataItem();
It is expected that the dataItem will be confections, but it is actually Diary Products.
Thanks