MVVM Binding, Kendo UI Mobile and Dropdownlist

4 posts, 0 answers
  1. Robert
    Robert avatar
    17 posts
    Member since:
    Mar 2011

    Posted 09 Oct 2013 Link to this post

    Hi There,

    I'm trying to get a dropdown list used with Kendo UI mobile and data bind the source of the dropdown list to some set data.

    It seems to work when a plain select is used but when i change the data-role to dropdown list the list is always empty. 

    I have include a sample of the problem i am experiencing.

    http://jsbin.com/ADOTuG/1/

    Is there something I am doing wrong here or should do differently?

    Thanks,

    Rob
  2. Petyo
    Admin
    Petyo avatar
    2444 posts

    Posted 09 Oct 2013 Link to this post

    Hi Robert,

    the recommended way to use MVVM with Kendo UI Mobile would be through the data-model attribute. Please check this updated version of your sample.

    Regards,
    Petyo
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Robert
    Robert avatar
    17 posts
    Member since:
    Mar 2011

    Posted 10 Oct 2013 Link to this post

    Hi Petyo,

    I have a number of problems using the data-model configuration because I need to bind data dynamically rather than using the same observable always. I also need to specify data binding at a more specific level that just whole mobile view.

    How would I perform data binding of two different models to two div tags in the same view in a mobile environment?

    I currently bind the views using the kendo.bind command (It satisfies all of my requirements) and it works as expected on each div, I am just unable to get data binding of the drop down list working.

    Thanks,

    Rob
  4. Petyo
    Admin
    Petyo avatar
    2444 posts

    Posted 14 Oct 2013 Link to this post

    Hello Robert,

    you may consider using a single viewmodel and assigning the two models in question to its fields.

    The reason why we recommend using data-model instead of kendo.bind is performance. The mobile views do declarative initialization of the widgets (based on the data-role attribute), and kendo.bind does the same + establishing the bindings. The data-model field performs this in a single pass, thus avoiding the costly DOM recursive traversing. 

    In case you insist on using the kendo.bind approach, you will have to pass multiple namespaces as arguments, as documented and showcased in our API reference

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