Class UbuntuUI.List
Class defined in:list.js:23
A List comes with various options, including: a <em>header</em>, 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:104
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:144
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
DOMElement
element
(
)
list.js:187
Returns the DOM element associated with the selector this widget is bind to.
Returns: <DOMElement>
Example
var mylist = UI.list("#listid").element();
forEach
( func
)
list.js:174
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:155
Removes a list item <li> by its index, where index counting starts from 1
Parameters:-
index
<Number>