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

Commit

Permalink
Merge pull request #5018 from jquery/listDefaultIcon
Browse files Browse the repository at this point in the history
Listview: Added option for the default list icon
  • Loading branch information
jasondscott committed Oct 9, 2012
2 parents b1837c7 + d73c9ef commit 4a9427c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
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

0 comments on commit 4a9427c

Please sign in to comment.