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

Binding and external View

2 Answers 97 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Georg
Top achievements
Rank 1
Georg asked on 20 Sep 2012, 05:36 PM
Hi,

i got a external view - linked with <a href="page2.html"> from my main page. In this view is a tag which i want to bind a variable. How do i know when the view is loaded, so i can bind my variable?

Bye

Georg

2 Answers, 1 is accepted

Sort by
0
Accepted
Jeremy Wiebe
Top achievements
Rank 1
answered on 20 Sep 2012, 06:18 PM
Is this using Kendo Mobile or is it a desktop site?   If it's non-Kendo Mobile site you will be loading an entirely new page, which means you can use the jQuery document ready function as a place to bind your new document to a Kendo model.  

If you are in Kendo Mobile then there is a built-in method to do this.  In your new mobile view (which would be inpage2.html) you can add an attribute 'data-init'.  This attribute specifies a javascript method to call when the view has been loaded.  

page2.html
<div data-role="view" data-init="init_page2">
   <!-- Some content -->
</div>
<script type="text/javascript">
  function init_page2() {
    alert("Page 2 loaded");
  }
</script>
0
Georg
Top achievements
Rank 1
answered on 20 Sep 2012, 07:14 PM
Hi Jeremy,

i am using Kendo Mobile and it works. Big thanks to you!

Cu

Georg

Tags
MVVM
Asked by
Georg
Top achievements
Rank 1
Answers by
Jeremy Wiebe
Top achievements
Rank 1
Georg
Top achievements
Rank 1
Share this question
or