ViewModel and Show event

3 posts, 1 answers
  1. Sebastian
    Sebastian avatar
    2 posts
    Member since:
    Oct 2013

    Posted 28 Oct 2013 Link to this post

    Hi Everyone,
    I'm quite new to Kendo UI Mobile on Icenium, and i'm currently trying to refresh the data i have on my mvvm viewmodel, basically i have a view model with a datasource and a function named showView: wich i would like to be called after the view is presented to the user, i tried seeking on the documentation but i wasen't unable to make raise data-show on my viewmodel. Could any one be so kind to provide me a working example, the viewmodel is created like the one on visual studio sample, with an added showView: function().. 
    I need this because i need to load  fresh data from localStorage, do some stuff with it and populate the datasource to show a result on the screen.
     
    Thanks
    Sebastian
  2. Answer
    Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2596 posts

    Posted 30 Oct 2013 Link to this post

    Hello Sebastian,

    Please check the following link explaining how to use MVVM in Kendo UI Mobile application.

    http://docs.kendoui.com/getting-started/mobile/mvvm

    As for your question - you cannot bind view events directly to the viewModel. What you can do is access the function inside the viewModel and assign it to the view event. Please check the following example:

    http://jsbin.com/ANonecU/1/edit
     
    Regards,
    Kiril Nikolov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Sebastian
    Sebastian avatar
    2 posts
    Member since:
    Oct 2013

    Posted 30 Oct 2013 Link to this post

    Hi Kiril,
    thanks for your answer i just discovered that my self :), initially i hoped that i could set the data-model on the parent element, and then bind the function to the show action, that would be nicer an cleaner design, but what it matter for me now is that it works :)
    Thanks for your help
    Sebastian
Back to Top