UbuntuUI.Pagestack

Class UbuntuUI.Pagestack

Class defined in: 0.1/ambiance/js/pagestacks.js:23

The Pagestack manages all Pages in a stack data structure. Initially, the Pagestack contains no Pages. The push() method is normally executed on load to display the app starting page.

 UI.pagestack.push("pageID")

The topmost Page on the Pagestack is always displayed.

The Pagestack is declared as a direct child of the content div.

The Pagestack contains a default footer (represented in JavaScript as a Toolbar), even if you do not declare one in HTML. The footer has a single Back button.

This application-wide footer can be customized (for example, you can add Buttons) by declaring a footer as a direct child of the pagestack div (see example).

Page specific footers

A page may declare a page-specific footer as a child element.

UbuntuUI.Pagestack ( )

0.1/ambiance/js/pagestacks.js:23

Example

<div data-role="page">
   <header data-role="header">
     [...]
   </header>
   <div data-role="content">
     <div data-role="pagestack">
       <div data-role="page" id="main">
       </div>
       <div data-role="page" id="page2">
         [...]
         <footer data-role="footer" class="revealed" id="footerPage2">
           [...]
         </footer>
       </div>
       <footer data-role="footer" class="revealed" id="footerAppWide">
         [...]
       </footer>
     </div>  <!-- end of Pagestack div -->
   </div>
 </div>

 JavaScript:
 UI.pagestack.METHOD();

Methods

PageID | Null

currentPage ( )

0.1/ambiance/js/pagestacks.js:150

Gets the id attribute of the page element on top of this pagestack


Returns: <PageID | Null>
  • The topmost page's id attribute, else null when there are no pages on this pagestack

Number

depth ( )

0.1/ambiance/js/pagestacks.js:158

Gets the number of pages in this pagestack


Returns: <Number>
  • The number of pages in this pagestack

Boolean

isEmpty ( )

0.1/ambiance/js/pagestacks.js:142

Checks for zero pages in this pagestack


Returns: <Boolean>
  • True when this pagestack has no pages, else false

pop ( )

0.1/ambiance/js/pagestacks.js:173

Pops the current page off this pagestack, which causes the next page to become the top page and to display


push ( id, properties )

0.1/ambiance/js/pagestacks.js:128

Push a page to the top of this pagestack

Parameters

  • id <String>
    • The id attribute of the page element to be pushed
  • properties <Object>
    • This param is not currently used