API Docs for: 0.1

Class UbuntuUI.List

Class defined in: list.js:23

A List comes with various options, including: a header, main text (pushed left), an icon (pushed left), and a secondary label (pushed right).

UbuntuUI.List( )
list.js:23
Example
<section data-role="list" id="testlist">
  <header>My header text</header>
  <ul>
    <li>
      <a href="#">Main text, to the left</a>
    </li>
    <li>
      <a href="#">Main text</a>
      <label>Right text</label>
    </li>
    <li>
      <aside>
        <img src="someicon.png">
      </aside>
      <a href="#">Main text</a>
      <label>Right</label>
    </li>
  </ul>
 </section>

 JavaScript access:
   var list = UI.list('[id="testlist"]');
Element append( text, label, id, onclick, user_data )
list.js:101

Append an item to a list

Parameters:
  • text <String>
    • The main text, flushed left (no markup)
  • label <String>
    • Additional text, flushed right (no markup)
  • id <ID>
    • An id attribute value set for the new list item (must be unique in DOM)
  • onclick <Function>
    • The click callback function
  • user_data <Object>
    • Additional data that is passed to the click callback

Returns: <Element>
  • The created list item, or null on failure ot create
at( index )
list.js:141

Gets a list item <li> by its index, where index counting starts from 1

Parameters:
  • index <Number>

Returns:

The list item, or null on failure

forEach( func )
list.js:171

Iterates over all list items and runs a provided function on each

Parameters:
  • func <Function>
    • The function to run on each list item
remove( index )
list.js:152

Removes a list item <li> by its index, where index counting starts from 1

Parameters:
  • index <Number>
removeAllItems( )
list.js:163

Removes all items from a list

setHeader( text )
list.js:76

Add or Set the List Header

Parameters:
  • text <String>
    • The header text