init and show events of the View widget
The Kendo UI Mobile View widget exposes two important events: init
and show
. Event handlers for these events can be wired using data attributes as shown:
<div data-role="view" data-init="onInitialize" data-show="onShow"> </div> <script> var app = new kendo.mobile.Application(document.body); function onInitialize(e) { alert('view initialized'); } function onShow(e) { alert('view shown'); } </script>
Tip
Try it in jsFiddle: http://jsfiddle.net/kendomobile/vWC39/
The init
event is fired first and only once, after the View and its child widgets are initialized. The show
event is fired whenever the view becomes visible. The init
event is designed to be used for actions which should be done only once during the life cycle of a view, for example, creating a widget programmatically using JavaScript code. This must not be done in the show
event as the code will try to create the widget whenever the view becomes...