API Docs for: 0.1

Class UbuntuUI.Pagestack

Class defined in: 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.

Default application wide footer

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.

Customized application wide footer

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( )
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();
PageID | Null currentPage( )
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( )
pagestacks.js:158

Gets the number of pages in this pagestack


Returns: <Number>
  • The number of pages in this pagestack
Boolean isEmpty( )
pagestacks.js:142

Checks for zero pages in this pagestack


Returns: <Boolean>
  • True when this pagestack has no pages, else false
pop( )
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 )
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