Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Listview: Added option for the default list icon #5018

Merged
merged 5 commits into from
Oct 9, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/api/data-attributes.html
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,10 @@ <h2><a href="../lists/docs-lists.html">Listview</a></h2>
<th>data-header-theme</th>
<td>swatch letter (a-z)</td>
</tr>
<tr>
<th>data-icon</th>
<td>home | delete | plus | arrow-u | arrow-d | check | gear | grid | star | custom | arrow-r | arrow-l | minus | refresh | forward | back | alert | info | search | false</td>
</tr>
<tr>
<th>data-inset</th>
<td>true | <strong>false</strong></td>
Expand Down
11 changes: 11 additions & 0 deletions docs/lists/lists-options.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ <h2>Listviews</h2>
<p>This option is also exposed as a data attribute: <code>data-header-theme=&quot;a&quot;</code>.</p>
</dd>

<dt><code>icon</code> <em>string</em></dt>
<dd>
<p class="default">default: "arrow-r"</p>
<p>Applies an icon from the <a href="../buttons/buttons-icons.html">icon set</a> to all <a href="lists-ul.html">linked list buttons</a>. To set the value for all instances of this widget, bind this option to the <a href="../api/globalconfig.html">mobileinit event</a>:</p>
<pre><code>$( document ).bind( "mobileinit", function(){
<strong>$.mobile.listview.prototype.options.icon = "star";</strong>
});
</code></pre>
<p>This option is also exposed as a data attribute: <code>data-icon=&quot;star&quot;</code>.</p>
</dd>

<dt><code>initSelector</code> <em>CSS selector string</em></dt>
<dd>
<p class="default">default: ":jqmData(role='listview')"</p>
Expand Down
4 changes: 3 additions & 1 deletion js/widgets/listview.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
countTheme: "c",
headerTheme: "b",
dividerTheme: "b",
icon: "arrow-r",
splitIcon: "arrow-r",
splitTheme: "b",
inset: false,
Expand Down Expand Up @@ -163,6 +164,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
dividertheme = $list.jqmData( "dividertheme" ) || o.dividerTheme,
listsplittheme = $list.jqmData( "splittheme" ),
listspliticon = $list.jqmData( "spliticon" ),
listicon = $list.jqmData( "icon" ),
li = this._getChildrenByTagName( $list[ 0 ], "li", "LI" ),
ol = !!$.nodeName( $list[ 0 ], "ol" ),
jsCount = !$.support.cssPseudoElement,
Expand Down Expand Up @@ -211,7 +213,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
shadow: false,
corners: false,
iconpos: "right",
icon: a.length > 1 || icon === false ? false : icon || "arrow-r",
icon: a.length > 1 || icon === false ? false : icon || listicon || o.icon,
theme: itemTheme
});

Expand Down