MVVM bound DropDownList problem: first value appears blank

2 posts, 0 answers
  1. Siddhartha
    Siddhartha avatar
    7 posts
    Member since:
    Apr 2012

    Posted 23 Apr 2012 Link to this post

    Problem reproduced at

    I am using a drop down list, with following bindings to a view model:
    1. source (simple array of items)
    2. value 

    I have also defined the data-role and, perhaps most importantly for this query, a data-option-label.

    The problem is that if the data source defined in the view model is defined as an empty array, and at some point the data source is modified, the drop down list has an empty element, even before the data-option-label. (See the jsfiddle linked above).

    On the other hand, if the data source had an element and afterwards was modified in the same way, the drop down list does not have an empty element.

    What could be the problem here? Any pointers are appreciated.

    Siddhartha Agrawal
  2. Georgi Krustev
    Georgi Krustev avatar
    3747 posts

    Posted 24 Apr 2012 Link to this post

    Hello Siddhartha,

    The described behavior is expected. When you set the dataSource of the model, you just set the dataSource option of the DropDownList. In this case the DropDownList will not be initialized again. If you need to select an item then you will need to set the value of the model.

    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top