Browse files

Document data-filtertext attribute

  • Loading branch information...
jakeboone02 committed Nov 24, 2011
1 parent 47cf8d6 commit 37499c4df9275b8f24dea2f445141deb1dd244f9
Showing with 8 additions and 6 deletions.
  1. +4 −0 docs/api/data-attributes.html
  2. +4 −6 docs/lists/docs-lists.html
@@ -290,6 +290,10 @@ <h2><a href="../lists/docs-lists.html">Listview</a></h2>
<h2><a href="../lists/docs-lists.html">Listview item</a></h2>
<p>LI within a listview</p>
+ <tr>
+ <th>data-filtertext</th>
+ <td>string (filter by this value instead of inner text)</td>
+ </tr>
<td>home | delete | plus | arrow-u | arrow-d | check | gear | grid | star | custom | arrow-r | arrow-l | minus | refresh | forward | back | alert | info | search</td>
@@ -73,13 +73,11 @@ <h2>Search filter</h2>
<p>If you want to change the way in which list items are filtered, ie fuzzy search or matching from the beginning of the string, you can configure the callback used internally by defining <code>$.mobile.listview.prototype.options.filterCallback</code> during <code>mobileinit</code> or after the widget has been created with <code>$("#mylist").listview('option', 'filterCallback', yourFilterFunction)</code>. Any function defined for the callback will be provided two arguments. First, the text of the current list item and second, the value being searched for. A truthy value will result in a hidden list item. The default callback which filters entries without the <code>searchValue</code> as a substring is described below:
- <pre>
- <code>
-function( text, searchValue ){
+<pre><code>function( text, searchValue ){
return text.toLowerCase().indexOf( searchValue ) === -1;
- </code>
- </pre>
+ <p>To filter list items by values other than the text, add a <code>data-filtertext</code> attribute to the list item. The value of this attribute will be passed as the first argument to the <code>filterCallback</code> function instead of the text.</p>
<h2>Text formatting &amp; counts</h2>
<p>The framework includes text formatting conventions for common list patterns like header/descriptions, secondary information and counts through semantic HTML markup.</p>

0 comments on commit 37499c4

Please sign in to comment.