This is a migrated thread and some comments may be shown as answers.

ViewModel and Show event

2 Answers 90 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Sebastian
Top achievements
Rank 1
Sebastian asked on 28 Oct 2013, 11:46 AM
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 Answers, 1 is accepted

Sort by
0
Accepted
Kiril Nikolov
Telerik team
answered on 30 Oct 2013, 08:07 AM
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!
0
Sebastian
Top achievements
Rank 1
answered on 30 Oct 2013, 09:45 AM
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
Tags
MVVM
Asked by
Sebastian
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Sebastian
Top achievements
Rank 1
Share this question
or