MVVM DropDownList data-value-field is required even if data-value-primitive is set to false

2 posts, 0 answers
  1. Oleksandr
    Oleksandr avatar
    6 posts
    Member since:
    Dec 2014

    Posted 28 Jul 2015 Link to this post

    I created a demo based on standard dropdown MVVM demo which shows the behavior. For some reason DropDownList ​doesn't set it's value binding destination in case data-value-field attribute is not present. If you uncomment my attribute


    ​example works fine.

    But it took me a while to figure out what's missing there. I can't understand why I must specify data-value-field even though I set data-value-primitive="false", so data-value-field isn't used in any case. Documentation also says that dataValueField could be absent.


  2. Plamen
    Plamen avatar
    2817 posts

    Posted 30 Jul 2015 Link to this post


    By default the DropDownList uses the selected item from the data to update the View-Model field when the initial value is null. If you set data-value-primitive attribute to true it only changes the behavior so the View-Model field should be updated with the item value field. All the other configurations have to be the same so that the value is coming correctly from the datasource. Here is the documentation article about this behavior.

    Hope this information will be helpful.

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