Page Events and Methods

TAU supports the "page" as a component. This means that a created page has several events and methods. This section introduces the events and methods in the TAU Page component.

Table of Contents

  1. Events
  2. Binding the Hardware Back Key Event
  3. Methods

Events

The following table lists the events related to pages.

Event Description
pagebeforechange

Triggered before switching from the current page.

pagebeforecreate

Triggered before the new page component is created and initialized.

pagebeforehide

Triggered before the current page is about to be closed.

pagebeforeload

Triggered before an external page is loaded.

pagebeforeshow

Triggered before the new page is displayed.

pagechange

Triggered after switching from the current page to the new page.

pagechangefailed

Triggered when the page switching fails.

pagecreate

Triggered after the new page component creation.

pagehide

Triggered after the current page is hidden.

pageinit

Triggered after the page component initialization occurs.

pageload

Triggered after an external page is loaded.

pageremove

Triggered after an external page is removed from the DOM.

pageshow

Triggered after the new page is displayed.

Binding the Hardware Back Key Event

To bind an event callback on the Back key, use the following code:

window.addEventListener('tizenhwkey', function(ev) 
{
   if (ev.originalEvent.keyName == "back") 
   {
      // Call window.history.back() to go to previous browser window 
      // Call tizen.application.getCurrentApplication().exit() to exit application 
      // Add script to add another behavior 
   }
});

Methods

Summary

Method Description
addBackBtn (  ) 
- deprecated

Adds the Back button.

blur (  ) 

Removes the focus from the page and all descendants.

focus (  ) 

Sets the focus to the page.

updatePageLayout (  ) 

Calculates and updates the content height.

addBackBtn: deprecated

Adds the Back button.

addBackBtn ( ) 

Note
This method is deprecated since 2.3 because you can use the hardware Back key.
blur

Removes the focus from the page and all descendants.

blur ( ) 
Note
This method is only available through the TAU API.

Return value:

No return value

Code example:

<div id="myPage"></div>
<script type="text/javascript">
   var page = tau.widget.Page(document.getElementById("myPage"));
   page.blur();
</script>
focus

Sets the focus to the page. For example, when the page has an input element (the autofocus attribute), it focuses this element automatically.

focus ( ) 
Note
This method is only available through the TAU API.

Return value:

No return value

Code example:

<div id="myPage"></div>
<script type="text/javascript">
   var page = tau.widget.Page(document.getElementById("myPage"));
   page.focus();
</script>
updatePageLayout

Calculates and updates the content height.

updatePageLayout ( ) 
Note
This method is only available through the TAU API.

Return value:

No return value

Code example:

<div id="myPage"></div>
<script type="text/javascript">
   var page = tau.widget.Page(document.getElementById("myPage"));
   page.updatePageLayout();
</script>